Skip to content

Commit a9a81f2

Browse files
committed
run again as root, docker user has equivalent rights like root
1 parent cddd53f commit a9a81f2

File tree

2 files changed

+12
-28
lines changed

2 files changed

+12
-28
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
## 1.6.0 (12.05.2025)
44

55
- updated software versions and debian base image
6-
- run as non root
76

87
## 1.5.4 (10.02.2025)
98

Dockerfile

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ FROM ${BASE_IMAGE} as build-image
55
ARG RCLONE_VERSION="v1.69.2"
66
ARG RESTIC_VERSION="0.18.0"
77
ARG DOCKER_VERSION="28.1.1"
8-
ENV SUPERCRONIC_VERSION="v0.2.33"
98

109
RUN apt-get update && apt-get install --no-install-recommends -y \
1110
unzip \
@@ -26,14 +25,6 @@ RUN tar --extract --file docker-${DOCKER_VERSION}.tgz --directory /tmp/ --strip-
2625

2726
FROM ${BASE_IMAGE} as runtime-image
2827

29-
ARG USER_ID=1000
30-
ARG GROUP_ID=1000
31-
32-
RUN groupadd -g ${GROUP_ID} appuser && \
33-
useradd -u ${USER_ID} -g appuser -s /bin/sh -d /home/appuser appuser && \
34-
mkdir -p /home/appuser && \
35-
chown -R appuser:appuser /home/appuser
36-
3728
RUN \
3829
apt-get update \
3930
&& apt-get upgrade -y \
@@ -44,40 +35,34 @@ RUN \
4435
msmtp \
4536
tree \
4637
fuse \
38+
cron \
4739
ca-certificates \
4840
gzip \
4941
jq \
5042
openssh-client \
5143
&& apt-get clean \
5244
&& rm -rf /var/lib/apt/lists/*
5345

54-
# Install supercronic (instead of cron)
55-
RUN curl -fsSLO "https://github.com/aptible/supercronic/releases/download/${SUPERCRONIC_VERSION}/supercronic-linux-amd64" && \
56-
chmod +x supercronic-linux-amd64 && \
57-
mv supercronic-linux-amd64 /usr/local/bin/supercronic
58-
46+
# get rclone and restic from build-image
5947
COPY --from=build-image /bin/rclone /bin/rclone
6048
COPY --from=build-image /bin/restic /bin/restic
6149
COPY --from=build-image /tmp/docker /usr/local/bin/docker
6250

63-
RUN mkdir -p /local /var/log/restic /var/spool/cron/crontabs && \
64-
touch /var/log/cron.log /var/log/restic/backup.log /var/log/restic/lastrun.log && \
65-
chown -R appuser:appuser /local /var/log /var/spool/cron/crontabs && \
66-
chmod +x /bin/rclone /bin/restic /usr/local/bin/docker
51+
RUN mkdir -p /local /var/log/restic \
52+
&& touch /var/log/cron.log \
53+
&& touch /var/log/restic/backup.log \
54+
&& touch /var/log/restic/lastrun.log \
55+
&& chmod +x /bin/rclone /bin/restic /usr/local/bin/docker
56+
57+
# /data is the dir where you have to put the data to be backed up
58+
VOLUME /data
6759

6860
COPY backup.sh /bin/backup
6961
COPY check.sh /bin/check
7062
COPY entry.sh /bin/entry.sh
7163
COPY log.sh /bin/log.sh
7264
COPY pre-default.sh /bin/pre-default.sh
73-
COPY crontab /var/spool/cron/crontabs/appuser
74-
75-
RUN chmod +x /bin/backup /bin/check /bin/entry.sh /bin/log.sh /bin/pre-default.sh && \
76-
chown appuser:appuser /var/spool/cron/crontabs/appuser && \
77-
chmod 600 /var/spool/cron/crontabs/appuser
78-
79-
VOLUME /data
65+
RUN chmod +x /bin/backup /bin/check /bin/entry.sh /bin/log.sh /bin/pre-default.sh
8066

81-
USER appuser:appuser
8267
ENTRYPOINT ["/bin/entry.sh"]
83-
CMD ["supercronic", "/var/spool/cron/crontabs/appuser"]
68+
CMD ["cron", "-f", "-L", "2"]

0 commit comments

Comments
 (0)