Browse Source

functionnal doker

master
Adrien 4 years ago
parent
commit
f92222cc1e
6 changed files with 30 additions and 8 deletions
  1. +2
    -0
      .dockerignore
  2. +5
    -4
      Dockerfile
  3. +12
    -0
      Dockerfile.production
  4. +6
    -0
      README.md
  5. +1
    -1
      config/docker/nginx.conf
  6. +4
    -3
      docker-compose.yml

+ 2
- 0
.dockerignore View File

@@ -0,0 +1,2 @@
node_modules
dist

+ 5
- 4
Dockerfile View File

@@ -1,4 +1,5 @@
FROM nginx:latest

COPY config/docker/nginx.conf /etc/nginx/conf.d

FROM node:erbium
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn
ENTRYPOINT yarn dev

+ 12
- 0
Dockerfile.production View File

@@ -0,0 +1,12 @@
FROM node:erbium-alpine as build-stage
WORKDIR /app
COPY package.json .
RUN yarn
COPY . .
RUN yarn build

FROM nginx:1.17.9-alpine as production-stage
RUN mkdir /app
COPY --from=build-stage /app/dist /app
COPY config/docker/nginx.conf /etc/nginx/conf.d/nexus-timers.conf


+ 6
- 0
README.md View File

@@ -19,3 +19,9 @@ yarn build --report
```

For detailed explanation on how things work, checkout the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).

## Run via docker

`docker-compose up` will build an image with all dependencies, then bind the root directory to the container

`docker build . -f Dockerfile.production` will create an image with all project minified, optimized and served via nginx

+ 1
- 1
config/docker/nginx.conf View File

@@ -1,7 +1,7 @@
server {
listen 80;
server_name nexus-timers.local.tld;
root /usr/share/nginx/html/dist;
root /app;


access_log /var/log/nginx/nexus-timers.access.log;


+ 4
- 3
docker-compose.yml View File

@@ -1,6 +1,7 @@
nexus-timers:
dev:
build: .
volumes:
- .:/usr/share/nginx/html
- .:/app
- /app/node_modules
ports:
- 80:80
- 8080:8080

Loading…
Cancel
Save