From 19eee69906a5c4aba0ed6af4c1cc4ada2c1096f1 Mon Sep 17 00:00:00 2001 From: Adrien Agez Date: Thu, 28 May 2020 23:30:49 +0200 Subject: [PATCH] feat : add CI + update Dockerfile --- .drone.yml | 31 +++++++++++++++++++++++++++++++ Dockerfile | 3 ++- Dockerfile.production | 3 ++- config/docker/nginx.conf | 1 - 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..e2d9726 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,31 @@ +kind: pipeline +type: ssh +name: push + +server: + host: + from_secret: ssh_host + user: + from_secret: ssh_user + ssh_key: + from_secret: ssh_key + + +steps: + +- name: Build + commands: + - docker build . -f Dockerfile.production --tag="nexus-timers" + +- name: Stop and destroy old container + failure: ignore + commands: + - docker ps -a | grep nexus-timers | awk '{system ("docker stop " $1); system ("docker rm " $1)}' + +- name: Launch new container + commands: + - docker run -p 7000:80 -d nexus-timers + +trigger: + branch: + - master diff --git a/Dockerfile b/Dockerfile index 3bcec9d..4ea8635 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM node:erbium +FROM node:erbium-alpine +RUN apk add python2 WORKDIR /app COPY package.json yarn.lock ./ RUN yarn diff --git a/Dockerfile.production b/Dockerfile.production index 54c83db..a423fd1 100644 --- a/Dockerfile.production +++ b/Dockerfile.production @@ -1,7 +1,7 @@ FROM node:erbium-alpine as build-stage RUN apk add python2 WORKDIR /app -COPY package.json . +COPY package.json yarn.lock ./ RUN yarn COPY . . RUN yarn build @@ -9,5 +9,6 @@ RUN yarn build FROM nginx:1.17.9-alpine as production-stage RUN mkdir /app COPY --from=build-stage /app/dist /app +RUN rm /etc/nginx/conf.d/default.conf COPY config/docker/nginx.conf /etc/nginx/conf.d/nexus-timers.conf diff --git a/config/docker/nginx.conf b/config/docker/nginx.conf index 01367b2..a883b73 100644 --- a/config/docker/nginx.conf +++ b/config/docker/nginx.conf @@ -1,6 +1,5 @@ server { listen 80; - server_name nexus-timers.local.tld; root /app;