From 786f06d1f88beef899367254347b66fbed1aef29 Mon Sep 17 00:00:00 2001 From: Esko Ikkala <esko.ikkala@aalto.fi> Date: Tue, 12 Jun 2018 15:16:11 +0300 Subject: [PATCH] Dockerize --- .dockerignore | 2 ++ Dockerfile | 23 +++++++++++++++++++++++ README.md | 15 +++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 README.md diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..93f13619 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +npm-debug.log diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d7434031 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM node:10.4-alpine + +RUN mkdir /opt/hipla-full-stack && chown node:node /opt/hipla-full-stack + +# Create app directory +WORKDIR /opt/hipla-full-stack + +USER node + +# Install app dependencies +# A wildcard is used to ensure both package.json AND package-lock.json are copied +# where available (npm@5+) +COPY package*.json ./ +COPY webpack*.js ./ + +# Bundle app source +COPY src ./src + +RUN npm install && npm run build + +EXPOSE 3001 + +CMD ["node", "dist/server"] diff --git a/README.md b/README.md new file mode 100644 index 00000000..fe1588bf --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Hipla.fi + +## Build + `docker build -t hipla-full-stack .` + +## Run + `docker run -d -p 3005:3001 --name hipla hipla-full-stack` + +## Upgrade +``` +docker build -t hipla-full-stack . +docker stop hipla +docker rm hipla +docker run -d -p 3005:3001 --name hipla hipla-full-stack +``` -- GitLab