22 lines
No EOL
540 B
Docker
Executable file
22 lines
No EOL
540 B
Docker
Executable file
# build stage
|
|
FROM node:lts-alpine AS build-stage
|
|
WORKDIR ./app
|
|
COPY package.json ./
|
|
RUN npm i
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# production stage
|
|
FROM nginx:stable-alpine AS production-stage
|
|
|
|
# Remove default Nginx index page
|
|
RUN rm -rf /usr/share/nginx/html/*
|
|
# Copy built files from build stage
|
|
COPY --from=build-stage /app/dist /usr/share/nginx/html
|
|
EXPOSE 80
|
|
|
|
# Use a non-root user for security
|
|
RUN chown -R 101:101 /usr/share/nginx/html /var/cache/nginx /var/run /etc/nginx
|
|
USER 101
|
|
|
|
CMD ["nginx", "-g", "daemon off;"] |