From 476ce70a7f9ed1c52d14fe8edabc384a7c430a4a Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Sun, 12 Jan 2020 19:29:34 +0100 Subject: [PATCH] deployment --- .drone.yml | 34 ++++++++++++++++++++++++++++++++++ Dockerfile | 12 ++++++++++++ docker-compose.prod.yml | 22 ++++++++++++++++++++++ docker-compose.yml | 10 ++++++++++ package.json | 2 +- 5 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 .drone.yml create mode 100644 Dockerfile create mode 100644 docker-compose.prod.yml create mode 100644 docker-compose.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..bc0dcfd --- /dev/null +++ b/.drone.yml @@ -0,0 +1,34 @@ +kind: pipeline +name: default + +steps: + - name: build + image: node:alpine + pull: always + commands: + - node -v + - yarn -v + - yarn + - yarn run build + + - name: deploy + image: cupcakearmy/drone-deploy + pull: always + environment: + PLUGIN_KEY: + from_secret: ssh_key + settings: + host: fantus.studio + user: root + port: 1312 + target: /srv/web/fantus + sources: + - ./docker-compose.prod.yml + - ./package.json + - ./next.config.js + - ./.next + commands: + - docker-compose -f docker-compose.prod.yml up -d --build + when: + event: push + branch: master diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..de87aef --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM node:alpine + +WORKDIR /app + +COPY package.json . +COPY yarn.lock . +RUN yarn + +COPY next.config.js . +COPY .env . + +CMD [ "yarn", "run", "start" ] \ No newline at end of file diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml new file mode 100644 index 0000000..06e0b12 --- /dev/null +++ b/docker-compose.prod.yml @@ -0,0 +1,22 @@ +version: '3.7' + +networks: + traefik: + external: true + +services: + + front: + build: . + ports: + - 80 + volumes: + - ./.next:/app/.next + networks: + - traefik + labels: + - 'traefik.enable=true' + - 'traefik.backend=fantus' + - 'traefik.docker.network=traefik' + - 'traefik.frontend.rule=Host:fantus.studio' + - 'traefik.port=80' diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..0830dd6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.7' + +services: + + front: + build: . + ports: + - 80:80 + volumes: + - ./.next:/app/.next:ro diff --git a/package.json b/package.json index 29904ef..2d929b0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "scripts": { "dev": "next -p 80", - "build": "next build", + "build": "rm -rf .next && next build && rm -rf .next/cache", "start": "next start -p 80" }, "dependencies": {