Skip to content

Commit

Permalink
Server (#3)
Browse files Browse the repository at this point in the history
* added node server and docker files and express

* fixed env

* vie is 8626

* fixing the folder to serve for Vue

* now using port 9626
  • Loading branch information
johnpapa committed Nov 15, 2018
1 parent 5d2358d commit a1e97a0
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 84 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules
npm-debug.log
Dockerfile*
docker-compose*
.dockerignore
.git
.gitignore
.env
*/bin
*/obj
README.md
LICENSE
.vscode
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
NODE_ENV=production
PUBLIC_WEB=./public
PORT=9626
VUE_APP_API=https://papa-heroes-node-api.azurewebsites.net/api
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
NODE_ENV=development
PUBLIC_WEB=./public
PORT=9626
VUE_APP_API=api
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Client App
FROM node:10.13-alpine as client-app
LABEL authors="John Papa"
WORKDIR /usr/src/app
COPY ["package.json", "npm-shrinkwrap.json*", "./"]
RUN npm install --silent
COPY . .
ARG VUE_APP_API
ENV VUE_APP_API $VUE_APP_API
RUN npm run build

# Node server
FROM node:10.13-alpine as node-server
WORKDIR /usr/src/app
COPY ["package.json", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
COPY server.js .

# Final image
FROM node:10.13-alpine
WORKDIR /usr/src/app
# get the node_modules
COPY --from=node-server /usr/src /usr/src
# get the client app
COPY --from=client-app /usr/src/app/dist ./public
EXPOSE 9626
CMD ["node", "server.js"]
15 changes: 15 additions & 0 deletions docker-compose.debug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '2.1'

services:
heroes-vue:
image: heroes-vue
build: .
context: .
args:
VUE_APP_API: ${VUE_APP_API}
env_file:
- .env.development
ports:
- 9626:9626
- 9229:9229
command: node --inspect=0.0.0.0:9229 server.js
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '2.1'

services:
heroes-vue:
image: heroes-vue
build:
context: .
args:
VUE_APP_API: ${VUE_APP_API}
env_file:
- .env
ports:
- 9626:9626
Loading

0 comments on commit a1e97a0

Please sign in to comment.