Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd4eb1d8ee | ||
|
|
af5089f2a0 | ||
|
|
f0b2633cfb | ||
|
|
bf1eb19369 | ||
|
|
65e45f2d56 | ||
|
|
29322edd5e | ||
|
|
b03f1cdbe6 | ||
|
|
1fbd976753 | ||
|
|
e26d352601 | ||
|
|
ead6da4832 | ||
|
|
16864bb251 | ||
|
|
bbaefbb18d | ||
|
|
249963ced0 | ||
|
|
6407ca2880 | ||
|
|
156eb02ce0 |
@@ -1,48 +0,0 @@
|
||||
name: Docker build test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
- "!master"
|
||||
# Publish `v1.2.3` tags as releases.
|
||||
tags:
|
||||
- v*
|
||||
|
||||
# Run tests for any PRs.
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build-back:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Fake env file
|
||||
run: touch .env
|
||||
|
||||
- name: Build
|
||||
run: docker-compose -f docker-compose.production.yml build back
|
||||
|
||||
build-front:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Fake env file
|
||||
run: touch .env
|
||||
|
||||
- name: Build
|
||||
run: docker-compose -f docker-compose.production.yml build front
|
||||
@@ -1,8 +1,6 @@
|
||||
name: Docker
|
||||
name: Deploy production
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 4 * * 0" # run every sunday at 4 am to test if the image builds correctly given that changes of debian or compose packages can break the image
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
@@ -10,9 +8,6 @@ on:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
# Run tests for any PRs.
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
build-front:
|
||||
name: Build front
|
||||
@@ -38,7 +33,9 @@ jobs:
|
||||
context: front
|
||||
dockerfile: Dockerfile
|
||||
push: true
|
||||
tags: numerisisep/numeris-front:latest
|
||||
tags: numerisisep/numeris-front:prod
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha
|
||||
|
||||
build-back:
|
||||
name: Build back
|
||||
@@ -64,7 +61,9 @@ jobs:
|
||||
context: back
|
||||
dockerfile: Dockerfile.production
|
||||
push: true
|
||||
tags: numerisisep/numeris-back:latest
|
||||
tags: numerisisep/numeris-back:prod
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha
|
||||
|
||||
|
||||
pull-and-recreate:
|
||||
@@ -85,5 +84,5 @@ jobs:
|
||||
script: |
|
||||
cd numeris
|
||||
git pull
|
||||
docker-compose -f docker-compose.production.yml pull
|
||||
docker-compose -f docker-compose.production.yml up -d --force-recreate
|
||||
docker-compose -f docker-compose.infra.yml pull
|
||||
docker-compose -f docker-compose.infra.yml up -d --force-recreate
|
||||
@@ -0,0 +1,86 @@
|
||||
name: Deploy staging
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "staging"
|
||||
tags:
|
||||
- v*
|
||||
|
||||
jobs:
|
||||
build-front:
|
||||
name: Build front
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push front
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: front
|
||||
dockerfile: Dockerfile
|
||||
push: true
|
||||
tags: numerisisep/numeris-front:staging
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha
|
||||
|
||||
build-back:
|
||||
name: Build back
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push back
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: back
|
||||
dockerfile: Dockerfile.production
|
||||
push: true
|
||||
tags: numerisisep/numeris-back:staging
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha
|
||||
|
||||
pull-and-recreate:
|
||||
name: Pull and recreate
|
||||
needs:
|
||||
- build-front
|
||||
- build-back
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: executing remote ssh commands using password
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.HOST }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
# password: ${{ secrets.PASSWORD }}
|
||||
key: ${{ secrets.KEY }}
|
||||
port: ${{ secrets.PORT }}
|
||||
script: |
|
||||
cd numeris
|
||||
git pull
|
||||
docker-compose -f docker-compose.infra.yml pull
|
||||
docker-compose -f docker-compose.infra.yml up -d --force-recreate
|
||||
@@ -0,0 +1,111 @@
|
||||
name: Test docker build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "*"
|
||||
- "!master"
|
||||
- "!staging"
|
||||
# Publish `v1.2.3` tags as releases.
|
||||
tags:
|
||||
- v*
|
||||
|
||||
# Run tests for any PRs.
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
back-prod:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Fake env file
|
||||
run: touch .env
|
||||
|
||||
- name: Build back prod
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: back
|
||||
dockerfile: Dockerfile.production
|
||||
push: false
|
||||
tags: numerisisep/back:prod
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha
|
||||
|
||||
front-prod:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Fake env file
|
||||
run: touch .env
|
||||
|
||||
- name: Build front prod
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: front
|
||||
dockerfile: Dockerfile.production
|
||||
push: false
|
||||
tags: numerisisep/front:prod
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha
|
||||
|
||||
back-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Fake env file
|
||||
run: touch .env
|
||||
|
||||
- name: Build back dev
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: back
|
||||
dockerfile: Dockerfile
|
||||
push: false
|
||||
tags: numerisisep/back:dev
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha
|
||||
|
||||
front-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Fake env file
|
||||
run: touch .env
|
||||
|
||||
- name: Build front dev
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: front
|
||||
dockerfile: Dockerfile
|
||||
push: false
|
||||
tags: numerisisep/front:dev
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha
|
||||
@@ -1,6 +1,23 @@
|
||||
version: "3.9"
|
||||
services:
|
||||
|
||||
caddy:
|
||||
image: lucaslorentz/caddy-docker-proxy:ci-alpine
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
CADDY_INGRESS_NETWORKS: caddy
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
# docker rootless daemon socket https://docs.docker.com/engine/security/rootless/
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- caddy_data:/data
|
||||
networks:
|
||||
- caddy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "localhost:80"]
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin:latest
|
||||
container_name: numeris_phpmyadmin
|
||||
@@ -33,12 +50,9 @@ services:
|
||||
# - /var/run/mysqld:/var/run/mysqld
|
||||
|
||||
back:
|
||||
image: numerisisep/numeris-back
|
||||
image: numerisisep/numeris-back:prod
|
||||
container_name: numeris_back
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: ./back
|
||||
dockerfile: Dockerfile.production
|
||||
networks:
|
||||
- caddy
|
||||
- mysql
|
||||
@@ -51,14 +65,10 @@ services:
|
||||
labels:
|
||||
caddy: api.numeris-isep.fr
|
||||
caddy.reverse_proxy: "{{upstreams 80}}"
|
||||
# caddy.reverse_proxy.header_down: -Access-Control-Allow-Origin
|
||||
|
||||
front:
|
||||
image: numerisisep/numeris-front
|
||||
image: numerisisep/numeris-front:prod
|
||||
container_name: numeris_front
|
||||
build:
|
||||
context: ./front
|
||||
dockerfile: Dockerfile.production
|
||||
networks:
|
||||
- caddy
|
||||
labels:
|
||||
@@ -66,22 +76,31 @@ services:
|
||||
caddy.reverse_proxy: "{{upstreams 80}}"
|
||||
|
||||
|
||||
caddy:
|
||||
image: lucaslorentz/caddy-docker-proxy:ci-alpine
|
||||
back-staging:
|
||||
image: numerisisep/numeris-back:staging
|
||||
container_name: numeris_back
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
CADDY_INGRESS_NETWORKS: caddy
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
# docker rootless daemon socket https://docs.docker.com/engine/security/rootless/
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- caddy_data:/data
|
||||
networks:
|
||||
- caddy
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "localhost:80"]
|
||||
- mysql
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- .env:/home/numeris/.env
|
||||
depends_on:
|
||||
- mysql
|
||||
labels:
|
||||
caddy: api.staging.numeris-isep.fr
|
||||
caddy.reverse_proxy: "{{upstreams 80}}"
|
||||
|
||||
front-staging:
|
||||
image: numerisisep/numeris-front:staging
|
||||
container_name: numeris_front
|
||||
networks:
|
||||
- caddy
|
||||
labels:
|
||||
caddy: staging.numeris-isep.fr
|
||||
caddy.reverse_proxy: "{{upstreams 80}}"
|
||||
|
||||
networks:
|
||||
caddy:
|
||||
@@ -1,90 +0,0 @@
|
||||
version: "3.9"
|
||||
services:
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin/phpmyadmin:latest
|
||||
container_name: numeris_phpmyadmin
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 3000:80
|
||||
links:
|
||||
- mysql:db
|
||||
depends_on:
|
||||
- mysql
|
||||
networks:
|
||||
- caddy
|
||||
- mysql
|
||||
labels:
|
||||
caddy: phpmyadmin.staging.numeris-isep.fr
|
||||
caddy.reverse_proxy: "{{upstreams 80}}"
|
||||
|
||||
# mysql:
|
||||
# image: mysql:5.7
|
||||
# container_name: numeris_mysql
|
||||
# restart: unless-stopped
|
||||
# networks:
|
||||
# - mysql
|
||||
# env_file:
|
||||
# - .env
|
||||
# volumes:
|
||||
# - ./var/mysql:/var/lib/mysql
|
||||
|
||||
back:
|
||||
image: numerisisep/numeris-back
|
||||
container_name: numeris_back
|
||||
restart: unless-stopped
|
||||
build:
|
||||
context: ./back
|
||||
dockerfile: Dockerfile.production
|
||||
networks:
|
||||
- caddy
|
||||
- mysql
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- .env:/home/numeris/.env
|
||||
depends_on:
|
||||
- mysql
|
||||
labels:
|
||||
caddy: api.staging.numeris-isep.fr
|
||||
caddy.reverse_proxy: "{{upstreams 80}}"
|
||||
# caddy.reverse_proxy.header_down: -Access-Control-Allow-Origin
|
||||
|
||||
front:
|
||||
image: numerisisep/numeris-front
|
||||
container_name: numeris_front
|
||||
build:
|
||||
context: ./front
|
||||
dockerfile: Dockerfile.production
|
||||
networks:
|
||||
- caddy
|
||||
labels:
|
||||
caddy: staging.numeris-isep.fr
|
||||
caddy.reverse_proxy: "{{upstreams 80}}"
|
||||
|
||||
|
||||
# caddy:
|
||||
# image: lucaslorentz/caddy-docker-proxy:ci-alpine
|
||||
# restart: unless-stopped
|
||||
# environment:
|
||||
# CADDY_INGRESS_NETWORKS: caddy
|
||||
# ports:
|
||||
# - "80:80"
|
||||
# - "443:443"
|
||||
# volumes:
|
||||
# # docker rootless daemon socket https://docs.docker.com/engine/security/rootless/
|
||||
# - /var/run/docker.sock:/var/run/docker.sock
|
||||
# - caddy_data:/data
|
||||
# networks:
|
||||
# - caddy
|
||||
# healthcheck:
|
||||
# test: ["CMD", "curl", "-f", "localhost:80"]
|
||||
|
||||
networks:
|
||||
caddy:
|
||||
external: true
|
||||
mysql:
|
||||
|
||||
volumes:
|
||||
caddy_data:
|
||||
mysql:
|
||||
@@ -22,8 +22,6 @@ services:
|
||||
build:
|
||||
context: ./back
|
||||
dockerfile: Dockerfile
|
||||
env_file:
|
||||
- back/.env
|
||||
environment:
|
||||
DB_HOST: mysql
|
||||
DB_PORT: 3306
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
FROM node:11.15.0 as builder
|
||||
WORKDIR /opt/numeris
|
||||
ENV PATH /opt/numeris/node_modules/.bin:$PATH
|
||||
COPY package*.json /opt/numeris/
|
||||
COPY package.json yarn.lock /opt/numeris/
|
||||
RUN yarn install
|
||||
RUN yarn add -g @angular/cli@7.3.9
|
||||
# RUN yarn add -g @angular/cli@7.3.9
|
||||
COPY . .
|
||||
RUN yarn run build-prod
|
||||
ENTRYPOINT [ "ng", "serve", "--port", "80" ]
|
||||
|
||||
Reference in New Issue
Block a user