Dockerized Reactjs

1 Januari 2022 • 1 menit untuk membaca artikel ini

Dockerfile reactjs

FROM node:14-alpine AS builder
#ENV NODE_ENV production

WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM nginx:stable-alpine as production
#ENV NODE_ENV production

COPY --from=builder /app/build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

docker-compose reactjs

version: '3.8'

services:
  myapp:
    deploy:
      mode: replicated
      replicas: 2 
    image: registry.domain.tld/sumar/myapp:latest
    restart: always
    networks:
      - proxy-network

networks:
  proxy-network:
    external: true

Sumarsono

DevOps Engineer
Kembali ke atas

Docker Buildx on Manjaro>>

<<Dockerized Adonisjs