-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run management container as non-root (#3)
- Loading branch information
1 parent
9b2d93f
commit 8ff66ce
Showing
3 changed files
with
15 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,13 +25,13 @@ LABEL maintainer="[email protected]" | |
|
||
ENV TZ="Etc/UTC" \ | ||
DEBIAN_FRONTEND="noninteractive" \ | ||
DEBIAN_PACKAGES="bash cron curl git python3-pip python3-setuptools vim" | ||
DEBIAN_PACKAGES="bash cron curl git python3-pip python3-setuptools sudo vim" | ||
|
||
# copy the app | ||
COPY ./ /app | ||
|
||
# add to crontab | ||
COPY ./docker/wis2-grep-management.cron /etc/cron.d/wis2-grep-management.cron | ||
COPY ./docker/wis2-grep-management.cron /var/spool/cron/crontabs/wis2-grep | ||
|
||
RUN apt-get update -y && \ | ||
# install dependencies | ||
|
@@ -45,7 +45,13 @@ RUN apt-get update -y && \ | |
apt autoremove -y && \ | ||
apt-get -q clean && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
chmod 0644 /etc/cron.d/wis2-grep-management.cron && \ | ||
crontab /etc/cron.d/wis2-grep-management.cron | ||
chmod 0644 /var/spool/cron/crontabs/wis2-grep && \ | ||
crontab /var/spool/cron/crontabs/wis2-grep && \ | ||
# add wis2-grep user | ||
useradd -ms /bin/bash wis2-grep && \ | ||
adduser wis2-grep sudo && \ | ||
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
|
||
USER wis2-grep | ||
|
||
ENTRYPOINT [ "/app/docker/entrypoint.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
19 * * * * su -c "wis2-grep clean" > /proc/1/fd/1 2>/proc/1/fd/2 | ||
19 * * * * wis2-grep clean > /proc/1/fd/1 2>/proc/1/fd/2 |