init
This commit is contained in:
+36
@@ -0,0 +1,36 @@
|
||||
# Stage 1: Build client
|
||||
FROM node:18-alpine AS client-builder
|
||||
WORKDIR /client
|
||||
COPY client/package*.json ./
|
||||
RUN npm ci
|
||||
COPY client/ .
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production image
|
||||
FROM nginx:alpine
|
||||
|
||||
# Install Node.js for the server
|
||||
RUN apk add --no-cache nodejs npm
|
||||
|
||||
# Remove default nginx config
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copy custom nginx config
|
||||
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copy client build
|
||||
COPY --from=client-builder /client/dist /usr/share/nginx/html
|
||||
|
||||
# Copy server
|
||||
WORKDIR /server
|
||||
COPY server/package*.json ./
|
||||
RUN npm ci --omit=dev
|
||||
COPY server/ .
|
||||
|
||||
# Copy entrypoint
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
Reference in New Issue
Block a user