Update Dockerfile for improved production readiness
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- Ensure CSS variables are included in the build process. - Replace `node` with `serve` for serving the production build. - Adjust container health check timings for quicker feedback.
This commit is contained in:
17
Dockerfile
17
Dockerfile
@ -4,24 +4,19 @@ WORKDIR /app
|
|||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
COPY . .
|
COPY . .
|
||||||
|
# Ensure CSS variables are present
|
||||||
|
RUN mkdir -p public/styles
|
||||||
|
RUN cp -r styles/* public/styles/ || true
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:20-alpine AS production
|
FROM node:20-alpine AS production
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
RUN npm install -g serve
|
||||||
|
|
||||||
# Kopiere package.json und package-lock.json für Produktions-Abhängigkeiten
|
|
||||||
COPY package*.json ./
|
|
||||||
# Installiere nur Produktions-Abhängigkeiten
|
|
||||||
RUN npm ci --only=production && npm cache clean --force
|
|
||||||
|
|
||||||
# Kopiere das gebaute Projekt
|
|
||||||
COPY --from=build /app/dist ./dist
|
COPY --from=build /app/dist ./dist
|
||||||
|
|
||||||
# install minimal deps to run node if needed (alpine already has node)
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD ["node", "./dist/server/entry.mjs"]
|
CMD ["serve", "-s", "dist", "-l", "3000"]
|
||||||
|
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||||
CMD wget -qO- http://localhost:3000/ || exit 1
|
CMD wget -qO- http://localhost:3000/ || exit 1
|
||||||
Reference in New Issue
Block a user