[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 .dockerignore
Dockerfile Dockerfile
docker-compose.yaml 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 # Create app directory
RUN npm install -g serve WORKDIR /usr/src/app
# create a 'tmp' folder for the build and make it the current working directory # Install app dependencies
WORKDIR /app/tmp # 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 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 # Bundle app source
COPY . . COPY ./client .
# build for production with minification EXPOSE 3000
RUN npm run build RUN npm run build:dev
CMD ["node", "dist/index.js"]
# 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" ]

View File

@ -5,7 +5,6 @@
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build:prod": "webpack --config webpack.config.prod.js",
"build:dev": "webpack --config webpack.config.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'" "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: ports:
- '443:443' - '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 # For development purposes
adminer: adminer:
image: adminer image: adminer