From 95c2994b3c2ebe8ca44fef50839f996abfff41d9 Mon Sep 17 00:00:00 2001 From: Karmaa Date: Sun, 9 Feb 2025 02:15:19 -0600 Subject: [PATCH] Updated dockerfile for new file structure --- docker/Dockerfile | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 04579b24..bcf1b70c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,32 +1,33 @@ -# Build frontend -FROM node:18-alpine AS frontend-build +# Build everything in one stage +FROM node:18-alpine + +# Install nginx and dependencies +RUN apk add --no-cache nginx npm + +# Set working directory WORKDIR /app + +# Copy package files and install dependencies COPY package*.json ./ RUN npm install + +# Copy the entire project (frontend and backend) COPY ./ ./ + +# Build the frontend RUN npm run build -# Build backend and 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 +# Configure nginx COPY docker/nginx.conf /etc/nginx/nginx.conf -# Copy the built frontend files -COPY --from=frontend-build /app/dist /usr/share/nginx/html +# Copy built frontend to nginx's web directory +COPY ./dist /usr/share/nginx/html -# Copy the backend files -COPY --from=build /app/src/backend /src/backend -COPY --from=build /app/src/backend/entrypoint.sh /src/backend/entrypoint.sh +# Set up backend directory and entrypoint script +COPY ./src/backend /src/backend +COPY ./src/backend/entrypoint.sh /src/backend/entrypoint.sh -# Set up start-up +# Make entrypoint script executable RUN chmod +x /src/backend/entrypoint.sh # Expose necessary ports