Refactor Dockerfile and entrypoint script for improved structure and consistency
This commit is contained in:
19
Dockerfile
19
Dockerfile
@@ -1,29 +1,30 @@
|
|||||||
FROM node:24-trixie-slim AS build
|
FROM node:24-trixie-slim AS build
|
||||||
|
|
||||||
WORKDIR /app-new
|
WORKDIR /app
|
||||||
|
|
||||||
COPY app-new/backend/package*.json backend/
|
COPY app-new/backend/package*.json backend/
|
||||||
COPY app-new/frontend/package*.json frontend/
|
COPY app-new/frontend/package*.json frontend/
|
||||||
RUN cd backend && npm install
|
RUN cd backend && npm ci
|
||||||
RUN cd frontend && npm install
|
RUN cd frontend && npm ci
|
||||||
|
|
||||||
COPY app-new .
|
COPY app-new .
|
||||||
|
|
||||||
RUN cd backend && npm run build
|
RUN cd backend && npm run build
|
||||||
RUN cd frontend && npm run build
|
RUN cd frontend && npm run build
|
||||||
|
RUN cd backend && npm prune --omit=dev
|
||||||
|
|
||||||
FROM node:24-trixie-slim AS runtime
|
FROM node:24-trixie-slim AS runtime
|
||||||
|
|
||||||
WORKDIR /app-new
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV PORT=3000
|
ENV PORT=3000
|
||||||
|
|
||||||
COPY app-new/backend/package*.json ./
|
COPY --from=build /app/dist dist
|
||||||
RUN npm ci --omit=dev
|
COPY --from=build /app/templates templates
|
||||||
|
COPY --from=build /app/templates.json templates.json
|
||||||
|
COPY --from=build /app/backend/node_modules dist/backend/node_modules
|
||||||
|
|
||||||
COPY --from=build /app-new/dist dist
|
WORKDIR /app
|
||||||
COPY --from=build /app-new/templates templates
|
|
||||||
COPY --from=build /app-new/templates.json templates.json
|
|
||||||
COPY entrypoint.sh entrypoint.sh
|
COPY entrypoint.sh entrypoint.sh
|
||||||
RUN chmod +x entrypoint.sh
|
RUN chmod +x entrypoint.sh
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
exec node /app-new/dist/backend/server.js
|
exec node /app/dist/backend/server.js
|
||||||
|
|||||||
Reference in New Issue
Block a user