Fix reproducible frontend Docker deployment
This commit is contained in:
23
Dockerfile
23
Dockerfile
@@ -12,24 +12,9 @@ COPY . .
|
||||
ENV NODE_ENV=production
|
||||
RUN npm run build || exit 1
|
||||
|
||||
# Production stage
|
||||
FROM node:22-alpine AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
# Copy built assets and dependencies
|
||||
COPY --from=builder /app/build ./build
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY package.json .
|
||||
|
||||
# Non-root user
|
||||
RUN addgroup -S nsct && adduser -S nsct -G nsct
|
||||
USER nsct
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 CMD wget -qO- http://localhost:3000/health || exit 1
|
||||
# Production stage: serve the static SvelteKit output.
|
||||
FROM caddy:2.8-alpine AS runtime
|
||||
COPY Caddyfile.web /etc/caddy/Caddyfile
|
||||
COPY --from=builder /app/build /usr/share/caddy
|
||||
|
||||
EXPOSE 3000
|
||||
ENV HOST=0.0.0.0
|
||||
ENV PORT=3000
|
||||
|
||||
CMD ["node", "build"]
|
||||
Reference in New Issue
Block a user