Skip to content

Commit a01caba

Browse files
committed
Use "distroless" approach for web container to reduce image size from 2.44GB to 952MB
1 parent 99d5a40 commit a01caba

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

alfalfa_web/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,9 @@ WORKDIR /srv/alfalfa
2727

2828
# Run in watch mode so it will automatically restart
2929
CMD [ "npm", "run", "watch" ]
30+
31+
FROM gcr.io/distroless/nodejs22-debian12:latest as production
32+
COPY --from=base /srv/alfalfa /srv/alfalfa
33+
WORKDIR /srv/alfalfa
34+
35+
CMD [ "build/index.js" ]

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
# is to utilize shared code, specifically in db
77
dockerfile: alfalfa_web/Dockerfile
88
context: .
9-
target: base
9+
target: production
1010
args:
1111
- NODE_ENV
1212
image: ${REGISTRY_BASE_URI}/web:${VERSION_TAG}

0 commit comments

Comments
 (0)