generated from li0nhunter/Website-template
44 lines
1.0 KiB
Docker
44 lines
1.0 KiB
Docker
# Use official Node.js image
|
|
LABEL authors="Ari Yeger"
|
|
### Client Stage
|
|
FROM node:24 AS client-build
|
|
# Set the working directory for the client
|
|
WORKDIR /app/client
|
|
|
|
# Copy package files and install dependencies
|
|
COPY /client/package*.json ./
|
|
RUN npm ci
|
|
|
|
# Copy server source code
|
|
COPY /client .
|
|
|
|
# Build the server (if using TypeScript or build step)
|
|
RUN npm run build
|
|
|
|
### Server Stage
|
|
FROM node:24 AS server-build
|
|
# Set the working directory for the server
|
|
WORKDIR /app/server
|
|
|
|
# Copy package files and install dependencies
|
|
COPY /server/package*.json ./
|
|
RUN npm install
|
|
|
|
# Copy server source code
|
|
COPY /server .
|
|
|
|
# no build step for server, its already JavaScript
|
|
|
|
# Production stage
|
|
FROM node:24-slim AS production
|
|
WORKDIR /app
|
|
# Copy built client files from client-build stage
|
|
COPY --from=client-build /app/client/dist ./client/dist
|
|
# Copy server files from server-build stage
|
|
COPY --from=server-build /app/server ./server
|
|
WORKDIR /app/server
|
|
# Expose the port your server runs on (change if needed)
|
|
EXPOSE 8000
|
|
|
|
# Start the server
|
|
CMD ["npm", "start"] |