Skip to content

Commit

Permalink
Create user "diffy" and use it for all operations.
Browse files Browse the repository at this point in the history
  • Loading branch information
ygerasimov committed Jul 30, 2024
1 parent 14e1f09 commit c6b1e2d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions diffy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Add "diffy" user to the container.
ARG BASE_IMAGE
FROM $BASE_IMAGE
SHELL ["/bin/bash", "-c"]

ARG username
ARG uid
ARG gid
RUN (groupadd --gid $gid "$username" || groupadd "$username" || true) && (useradd -l -m -s "/bin/bash" --gid "$username" --comment '' --uid $uid "$username" || useradd -l -m -s "/bin/bash" --gid "$username" --comment '' "$username" || useradd -l -m -s "/bin/bash" --gid "$gid" --comment '' "$username" || useradd -l -m -s "/bin/bash" --comment '' $username )
8 changes: 8 additions & 0 deletions docker-compose.diffy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ services:
diffy:
container_name: ddev-${DDEV_SITENAME}-diffy
image: diffywebsite2/screenshot-worker:0.0.1
user: '$DDEV_UID:$DDEV_GID'
build:
context: 'diffy'
args:
BASE_IMAGE: diffywebsite2/screenshot-worker:0.0.1
username: "diffy"
uid: ${DDEV_UID}
gid: ${DDEV_GID}
command: tail -f /dev/null
restart: "no"
# These labels ensure this service is discoverable by ddev.
Expand Down
2 changes: 2 additions & 0 deletions install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ project_files:
- docker-compose.diffy.yaml
- commands/diffy/screenshot
- config.diffy.yaml
- diffy/Dockerfile

# List of files and directories that are copied into the global .ddev directory
# DDEV environment variables can be interpolated into these filenames
Expand Down Expand Up @@ -95,6 +96,7 @@ removal_actions:
- rm -rf commands/diffy
- rm -rf diffy-worker-main
- rm config.diffy.yaml
- rm -rf diffy

# Advanced usage - yaml files can be read in and then used as go template actions
# in pre_install_actions and post_install_actions
Expand Down

0 comments on commit c6b1e2d

Please sign in to comment.