Skip to content

Commit ecb7463

Browse files
committed
feat(docker): update Dockerfiles for lit-auth-server and lit-login-server to use multi-platform support and streamline dependency installation
1 parent ebdbe8e commit ecb7463

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

apps/lit-auth-server/Dockerfile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
# Tip: Modify "docker-build" options in project.json to change docker build args.
55
#
66
# Run the container with `docker run -p 3000:3000 -t lit-auth-server`.
7-
FROM docker.io/node:lts-alpine
7+
FROM --platform=linux/amd64 docker.io/node:lts-alpine
88

9+
ENV NODE_ENV=production
910
ENV HOST=0.0.0.0
1011
ENV PORT=3000
1112

@@ -14,12 +15,15 @@ WORKDIR /app
1415
RUN addgroup --system lit-auth-server && \
1516
adduser --system -G lit-auth-server lit-auth-server
1617

17-
COPY dist/apps/lit-auth-server lit-auth-server/
18-
COPY apps/lit-auth-server/package.json lit-auth-server/
19-
RUN chown -R lit-auth-server:lit-auth-server .
18+
COPY dist/apps/lit-auth-server/ ./
2019

21-
# You can remove this install step if you build with `--bundle` option.
22-
# The bundled output will include external dependencies.
23-
RUN npm --prefix lit-auth-server --omit=dev -f install
20+
# Install only production deps from the generated package.json/lockfile
21+
RUN corepack enable && pnpm install --prod --frozen-lockfile --ignore-scripts
2422

25-
CMD [ "node", "lit-auth-server" ]
23+
# Drop privileges
24+
USER lit-auth-server
25+
26+
ENV NODE_OPTIONS="--no-deprecation"
27+
28+
EXPOSE 3000
29+
CMD ["node", "main.cjs"]

apps/lit-login-server/Dockerfile

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,27 @@
44
# Tip: Modify "docker-build" options in project.json to change docker build args.
55
#
66
# Run the container with `docker run -p 3000:3000 -t lit-login-server`.
7-
FROM docker.io/node:lts-alpine
7+
FROM --platform=linux/amd64 docker.io/node:lts-alpine
88

9+
ENV NODE_ENV=production
910
ENV HOST=0.0.0.0
1011
ENV PORT=3000
1112

1213
WORKDIR /app
1314

14-
RUN addgroup --system lit-login-server && \
15-
adduser --system -G lit-login-server lit-login-server
15+
# Create non-root user
16+
RUN addgroup --system lit-login-server && adduser --system -G lit-login-server lit-login-server
1617

17-
COPY dist/apps/lit-login-server lit-login-server/
18-
COPY apps/lit-login-server/package.json lit-login-server/
19-
RUN chown -R lit-login-server:lit-login-server .
18+
# Copy Nx build artefacts (includes generated package.json and lockfile)
19+
COPY dist/apps/lit-login-server/ ./
2020

21-
# You can remove this install step if you build with `--bundle` option.
22-
# The bundled output will include external dependencies.
23-
RUN npm --prefix lit-login-server --omit=dev -f install
21+
# Install only production deps from the generated package.json/lockfile
22+
RUN corepack enable && pnpm install --prod --frozen-lockfile --ignore-scripts
2423

25-
CMD [ "node", "lit-login-server" ]
24+
# Drop privileges
25+
USER lit-login-server
26+
27+
ENV NODE_OPTIONS="--no-deprecation"
28+
29+
EXPOSE 3001
30+
CMD ["node", "main.cjs"]

0 commit comments

Comments
 (0)