Skip to content

Commit 3d4bcf5

Browse files
author
David Zuckerman
committed
creating home directory for bfs user and having production image run as bfs
1 parent c2b9d89 commit 3d4bcf5

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ USER root
44
# Configure users and groups
55
RUN groupadd -g 40054 alma && \
66
useradd -r -s /sbin/nologin -M -u 40054 -g alma alma && \
7-
useradd -u 40061 bfs && \
7+
useradd -u 40061 bfs -m && \
88
groupadd -g 40061 bfs && \
99
usermod -u 40061 -g bfs -G alma -l bfs default && \
1010
find / -user 1001 -exec chown -h bfs {} \; || true && \
@@ -53,6 +53,8 @@ FROM base AS production
5353
# COPY --from=development --chown=bfs /opt/app /opt/app
5454
COPY --from=development --chown=bfs /usr/local/bundle /usr/local/bundle
5555

56+
USER bfs
57+
5658
WORKDIR /opt/app
5759
RUN bundle config set frozen 'true'
5860
RUN bundle install --local

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ services:
1313
- ./:/opt/app:rw
1414
- ./secrets:/run/secrets:ro
1515
secrets:
16-
- source: SSH_KEY
17-
target: /opt/app/.ssh/id_rsa
16+
- source: SSH_KEY
17+
user: "bfs"
18+
target: /home/bfs/.ssh/id_rsa
1819
uid: "40061"
1920
gid: "40061"
2021
mode: 0400

0 commit comments

Comments
 (0)