Building Custom Nginx Docker Images
1 min read
- Authors
- Name
- Vijaykumar Rajendran
- @vijayrajendran_

Table of Contents
Custom Nginx Docker Images
Advanced Dockerfile
FROM nginx:alpine
RUN apk add --no-cache openssl
COPY nginx.conf /etc/nginx/
COPY sites/ /etc/nginx/sites-enabled/
COPY ssl/ /etc/nginx/ssl/
RUN nginx -t
HEALTHCHECK \
CMD curl -f http://localhost/health || exit 1
EXPOSE 80 443
CMD ["nginx", "-g", "daemon off;"]
Multi-Stage Build
FROM node:latest as builder
WORKDIR /app
COPY . .
RUN npm run build
FROM nginx:alpine
COPY /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Production images!