Skip to content

Commit

Permalink
Use a non-privileged user to run FerretDB (production docker image) (#…
Browse files Browse the repository at this point in the history
…4211)

Closes #3992.
  • Loading branch information
rumyantseva committed Mar 26, 2024
1 parent 407fbb8 commit 8b1adb0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions build/ferretdb/production.Dockerfile
Expand Up @@ -86,8 +86,9 @@ go build -v -o=bin/ferretdb ./cmd/ferretdb

go version -m bin/ferretdb
bin/ferretdb --version
EOF

mkdir /state
EOF

# stage for binary only

Expand All @@ -100,12 +101,12 @@ COPY --from=production-build /src/bin/ferretdb /ferretdb

FROM scratch AS production

COPY --from=production-build /src/bin/ferretdb /ferretdb
COPY build/ferretdb/passwd /etc/passwd
COPY build/ferretdb/group /etc/group
USER ferretdb:ferretdb

# TODO https://github.com/FerretDB/FerretDB/issues/3992
# COPY build/ferretdb/passwd /etc/passwd
# COPY build/ferretdb/group /etc/group
# USER ferretdb:ferretdb
COPY --from=production-build /src/bin/ferretdb /ferretdb
COPY --from=production-build --chown=ferretdb:ferretdb /state /state

ENTRYPOINT [ "/ferretdb" ]

Expand Down

0 comments on commit 8b1adb0

Please sign in to comment.