Skip to content

Commit 0bd4cdf

Browse files
committed
fix(docker): make containers rootless
closes #337
1 parent 1be4f47 commit 0bd4cdf

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

backend/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ RUN cargo build --release
1212
FROM ghcr.io/valhalla/valhalla:3.6.3@sha256:2b19ea46551a9687b245022551183829d817fdee9b58c5e7b2adb6e422749c43
1313

1414
WORKDIR /app
15-
COPY --from=build /app/target/release/backend /backend
15+
COPY --chown=ubuntu:ubuntu --from=build /app/target/release/backend /backend
16+
USER ubuntu
1617
# EXPOSE 3055
1718
ENTRYPOINT [ "/backend" ]

demo.pod.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
- name: traefik
1111
image: traefik:v3
1212
args:
13-
- --api.insecure=true
13+
- --api.insecure=true # REMOVE IN PROD!!!!!!!!!!
1414
- --entrypoints.web.address=:80
1515
- --providers.file.filename=/etc/traefik/dynamic.yml
1616
- --providers.file.watch=true

frontend/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ RUN pnpm prune --production
1212
FROM node:25-alpine@sha256:bdf2cca6fe3dabd014ea60163eca3f0f7015fbd5c7ee1b0e9ccb4ced6eb02ef4
1313

1414
WORKDIR /app
15-
COPY --from=build /app/build build/
16-
COPY --from=build /app/node_modules node_modules/
17-
COPY package.json .
15+
COPY --chown=node:node --from=build /app/build build/
16+
COPY --chown=node:node --from=build /app/node_modules node_modules/
17+
COPY --chown=node:node package.json .
1818
# EXPOSE 3000
1919
ENV NODE_ENV=production
20+
USER node
2021
CMD ["node", "build"]

0 commit comments

Comments
 (0)