viliusle / miniPaint

online image editor
http://viliusle.github.io/miniPaint/
Other
2.62k stars 610 forks source link

Docker file example #202

Closed viliusle closed 3 years ago

viliusle commented 3 years ago

Author: @PootisPenserHere PootisPenserHere Description: Added a basic Dockerfile with multi-stage to build the static version and deploy it with nginx

.dockerignore file:

.git
node_modules
Dockerfile
dist/

Dockerfile file:

# Stage 1 - the build process
FROM node:12 as build-deps

WORKDIR /usr/src/app

COPY package.json /usr/src/app
COPY package-lock.json /usr/src/app
RUN npm install

COPY . /usr/src/app
RUN npm run build

# Stage 2 - the production environment
FROM nginx:1-alpine

COPY --from=build-deps /usr/src/app/dist /usr/share/nginx/html/dist
COPY --from=build-deps /usr/src/app/index.html /usr/share/nginx/html
COPY --from=build-deps /usr/src/app/images /usr/share/nginx/html/images

EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]