mirror of
https://github.com/fromchat-messenger/web.git
synced 2026-09-22 19:15:08 +03:00
39 lines
783 B
Docker
39 lines
783 B
Docker
# 1. Build the frontend
|
|
FROM node:24 AS frontend
|
|
|
|
# 1.1. Install npm dependencies
|
|
WORKDIR /app
|
|
COPY package.json .
|
|
RUN --mount=type=cache,target=/root/.npm \
|
|
npm install --ignore-scripts
|
|
|
|
# 1.2. Build
|
|
COPY frontend frontend
|
|
RUN npm run build
|
|
|
|
# 2. Build the static file server
|
|
FROM node:24 AS server
|
|
|
|
# 2.1. Install npm dependencies
|
|
WORKDIR /server
|
|
COPY deployment/frontend/package.json .
|
|
RUN --mount=type=cache,target=/root/.npm \
|
|
npm install
|
|
|
|
# 2.2. Copy the code
|
|
COPY deployment/frontend/ .
|
|
|
|
# 3. Put it all together
|
|
FROM node:24-slim
|
|
|
|
# 3.1. Frontend static files
|
|
WORKDIR /app
|
|
COPY --from=frontend /app/frontend/dist .
|
|
|
|
# 3.2. Static file server
|
|
WORKDIR /server
|
|
COPY --from=server /server .
|
|
|
|
# 4. Final command
|
|
ENV STATIC_FILE_PATH=/app
|
|
ENTRYPOINT ["npm", "run", "start"] |