[Fix #11] [Fix #10] Client docker image

pull/16/head
sundowndev 2018-08-05 01:35:17 +02:00
parent 4eff277cfc
commit 8a501eb557
4 changed files with 26 additions and 23 deletions

View File

@ -7,3 +7,5 @@
.dockerignore
Dockerfile
docker-compose.yaml
/node_modules/
/npm-debug.log/

View File

@ -1,28 +1,20 @@
FROM node:9.3.0-alpine
FROM node:8
# install static server
RUN npm install -g serve
# Create app directory
WORKDIR /usr/src/app
# create a 'tmp' folder for the build and make it the current working directory
WORKDIR /app/tmp
# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY ./client/package*.json ./
# copy only the package.json to take advantage of cached Docker layers
COPY package.json .
# install project dependencies
RUN npm install
# If you are building your code for production
# RUN npm install --only=production
# copy project files and folders to the working directory
COPY . .
# Bundle app source
COPY ./client .
# build for production with minification
RUN npm run build
# make the 'app' folder the current working directory
WORKDIR /app
# clean up (i.e. extract 'dist' folder and remove everything else)
RUN mv tmp/dist dist && rm -fr tmp
EXPOSE 5000
CMD [ "serve", "--single", "--port", "3000", "dist" ]
EXPOSE 3000
RUN npm run build:dev
CMD ["node", "dist/index.js"]

View File

@ -5,7 +5,6 @@
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build:prod": "webpack --config webpack.config.prod.js",
"build:dev": "webpack --config webpack.config.js",
"dev": "tsc-watch src/index.ts --outDir ./dist --onSuccess 'node ./dist/index.js' --onFailure 'echo Beep! Compilation Failed'"
},

View File

@ -43,6 +43,16 @@ services:
ports:
- '443:443'
client:
build:
context: .
dockerfile: ./Dockerfile.client
volumes:
# Comment out the next line in production
- ./client:/usr/src/app:rw
ports:
- 3000:3000
# For development purposes
adminer:
image: adminer