Updated dockerfile for new file structure

This commit is contained in:
Karmaa
2025-02-09 02:13:44 -06:00
parent c5429ff2e8
commit 0b302fc860

View File

@@ -6,23 +6,32 @@ RUN npm install
COPY ./ ./
RUN npm run build
# Build backend
FROM node:18-alpine AS backend-build
WORKDIR /app/src/backend
# Build backend and configure nginx
FROM node:18-alpine AS build
WORKDIR /app
# Copy backend code
COPY ./src/backend /app/src/backend
# Configure nginx
FROM nginx:alpine
# Install nginx, nodejs, and npm
RUN apk add --no-cache nginx nodejs npm
RUN apk add --no-cache nodejs npm
# Copy nginx configuration
COPY docker/nginx.conf /etc/nginx/nginx.conf
# Copy the built frontend files
COPY --from=frontend-build /app/dist /usr/share/nginx/html
COPY --from=backend-build /app/src/backend /src/backend
COPY --from=backend-build /app/src/backend/entrypoint.sh /src/backend/entrypoint.sh
# Configure start-up
# 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 start-up
RUN chmod +x /src/backend/entrypoint.sh
ENTRYPOINT ["/src/backend/entrypoint.sh"]
# Expose necessary ports
EXPOSE 8080
EXPOSE 8081
EXPOSE 8081
# Use entrypoint.sh to run both the backend and nginx
ENTRYPOINT ["/src/backend/entrypoint.sh"]