Updated dockerfile for new file structure
This commit is contained in:
@@ -6,23 +6,32 @@ RUN npm install
|
|||||||
COPY ./ ./
|
COPY ./ ./
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# Build backend
|
# Build backend and configure nginx
|
||||||
FROM node:18-alpine AS backend-build
|
FROM node:18-alpine AS build
|
||||||
WORKDIR /app/src/backend
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copy backend code
|
||||||
COPY ./src/backend /app/src/backend
|
COPY ./src/backend /app/src/backend
|
||||||
|
|
||||||
# Configure nginx
|
# Install nginx, nodejs, and npm
|
||||||
FROM nginx:alpine
|
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 docker/nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
# Copy the built frontend files
|
||||||
COPY --from=frontend-build /app/dist /usr/share/nginx/html
|
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
|
RUN chmod +x /src/backend/entrypoint.sh
|
||||||
ENTRYPOINT ["/src/backend/entrypoint.sh"]
|
|
||||||
|
|
||||||
|
# Expose necessary ports
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
EXPOSE 8081
|
EXPOSE 8081
|
||||||
|
|
||||||
|
# Use entrypoint.sh to run both the backend and nginx
|
||||||
|
ENTRYPOINT ["/src/backend/entrypoint.sh"]
|
||||||
Reference in New Issue
Block a user