Files
endurain/Dockerfile_frontend
João Vitória Silva cef2064eaa Backend requirements bump
[README] README file updated
[frontend] Updated dockerfile for frontend image
[backend] Updated dockerfile for backend image
[backend] Removed .env file. Env variables loaded on docker build process
[frontend] Fixed .env file for frontend docker image
[frontend] Added nginx-custom.conf to fix reloads
[frontend] Added frontend_env.sh to fix env variables loading on docker image start
[docker] Updated docker compose example file
2024-05-23 09:58:24 +01:00

35 lines
870 B
Plaintext

# Use an official node runtime as a parent image
FROM node:20-alpine as build-stage
# Links Docker image with repository
LABEL org.opencontainers.image.source https://github.com/joaovitoriasilva/endurain
# Set the working directory to /app
WORKDIR /app
# Copy package.json and package-lock.json
COPY frontend/package*.json ./
RUN npm install
# Copy the current directory contents into the container at /app
COPY frontend ./
# Build the app
RUN npm run build
# Use nginx to serve the built app
FROM nginx:alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
COPY nginx-custom.conf /etc/nginx/conf.d/default.conf
COPY frontend_env.sh /docker-entrypoint.d/frontend_env.sh
RUN chmod +x /docker-entrypoint.d/frontend_env.sh
EXPOSE 80
ENV MY_APP_BACKEND_PROTOCOL=http
ENV MY_APP_BACKEND_HOST=backend
CMD ["nginx", "-g", "daemon off;"]