25 lines
677 B
Docker
25 lines
677 B
Docker
# Build stage
|
|
FROM node:slim AS build
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN npm run build -- --base=./
|
|
|
|
# NOTE: We copy the environment variables CLIENT_ to an .env file in the running container.
|
|
# This is done with the docker-entrypoint.sh script.
|
|
# We do this so one build can support many different environments.
|
|
|
|
# Production stage
|
|
FROM nginx:alpine
|
|
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN sed -i 's/\r$//' /docker-entrypoint.sh && chmod +x /docker-entrypoint.sh
|
|
|
|
EXPOSE 369
|
|
ENTRYPOINT ["/docker-entrypoint.sh"]
|