Updated dockerfile for new file structure
This commit is contained in:
@@ -1,32 +1,33 @@
|
|||||||
# Build frontend
|
# Build everything in one stage
|
||||||
FROM node:18-alpine AS frontend-build
|
FROM node:18-alpine
|
||||||
|
|
||||||
|
# Install nginx and dependencies
|
||||||
|
RUN apk add --no-cache nginx npm
|
||||||
|
|
||||||
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy package files and install dependencies
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
|
|
||||||
|
# Copy the entire project (frontend and backend)
|
||||||
COPY ./ ./
|
COPY ./ ./
|
||||||
|
|
||||||
|
# Build the frontend
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Build backend and configure nginx
|
# Configure nginx
|
||||||
FROM node:18-alpine AS build
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Copy backend code
|
|
||||||
COPY ./src/backend /app/src/backend
|
|
||||||
|
|
||||||
# Install nginx, nodejs, and npm
|
|
||||||
RUN apk add --no-cache nginx nodejs npm
|
|
||||||
|
|
||||||
# Copy nginx configuration
|
|
||||||
COPY docker/nginx.conf /etc/nginx/nginx.conf
|
COPY docker/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
# Copy the built frontend files
|
# Copy built frontend to nginx's web directory
|
||||||
COPY --from=frontend-build /app/dist /usr/share/nginx/html
|
COPY ./dist /usr/share/nginx/html
|
||||||
|
|
||||||
# Copy the backend files
|
# Set up backend directory and entrypoint script
|
||||||
COPY --from=build /app/src/backend /src/backend
|
COPY ./src/backend /src/backend
|
||||||
COPY --from=build /app/src/backend/entrypoint.sh /src/backend/entrypoint.sh
|
COPY ./src/backend/entrypoint.sh /src/backend/entrypoint.sh
|
||||||
|
|
||||||
# Set up start-up
|
# Make entrypoint script executable
|
||||||
RUN chmod +x /src/backend/entrypoint.sh
|
RUN chmod +x /src/backend/entrypoint.sh
|
||||||
|
|
||||||
# Expose necessary ports
|
# Expose necessary ports
|
||||||
|
|||||||
Reference in New Issue
Block a user