mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-12 23:35:50 +00:00
docker-compose
github workflows publish & lint
This commit is contained in:
parent
1c21dc1745
commit
2c5d780db4
52
.github/workflows/publish.yml
vendored
52
.github/workflows/publish.yml
vendored
@ -7,7 +7,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# JOB: DOCKER BUILD COMMUNITY NEO4J ##########################################
|
# JOB: DOCKER BUILD PRODUCTION FRONTEND ######################################
|
||||||
##############################################################################
|
##############################################################################
|
||||||
build_production_frontend:
|
build_production_frontend:
|
||||||
name: Docker Build Production - Frontend
|
name: Docker Build Production - Frontend
|
||||||
@ -43,6 +43,43 @@ jobs:
|
|||||||
name: docker-frontend-production
|
name: docker-frontend-production
|
||||||
path: /tmp/frontend.tar
|
path: /tmp/frontend.tar
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# JOB: DOCKER BUILD PRODUCTION BACKEND #######################################
|
||||||
|
##############################################################################
|
||||||
|
build_production_backend:
|
||||||
|
name: Docker Build Production - Backend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#needs: [nothing]
|
||||||
|
steps:
|
||||||
|
##########################################################################
|
||||||
|
# CHECKOUT CODE ##########################################################
|
||||||
|
##########################################################################
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
##########################################################################
|
||||||
|
# SET ENVS ###############################################################
|
||||||
|
##########################################################################
|
||||||
|
- name: ENV - VERSION
|
||||||
|
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV
|
||||||
|
- name: ENV - BUILD_DATE
|
||||||
|
run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
|
||||||
|
- name: ENV - BUILD_VERSION
|
||||||
|
run: echo "BUILD_VERSION=${VERSION}.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
|
||||||
|
- name: ENV - BUILD_COMMIT
|
||||||
|
run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV
|
||||||
|
##########################################################################
|
||||||
|
# BACKEND ################################################################
|
||||||
|
##########################################################################
|
||||||
|
- name: Backend | Build `production` image
|
||||||
|
run: |
|
||||||
|
docker build --target production -t "gradido/backend:latest" -t "gradido/backend:production" -t "gradido/backend:${VERSION}" -t "gradido/backend:${BUILD_VERSION}" backend/
|
||||||
|
docker save "gradido/backend" > /tmp/backend.tar
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: docker-backend-production
|
||||||
|
path: /tmp/backend.tar
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# JOB: DOCKER BUILD PRODUCTION LOGIN SERVER ##################################
|
# JOB: DOCKER BUILD PRODUCTION LOGIN SERVER ##################################
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -199,7 +236,7 @@ jobs:
|
|||||||
upload_to_dockerhub:
|
upload_to_dockerhub:
|
||||||
name: Upload to Dockerhub
|
name: Upload to Dockerhub
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build_production_frontend, build_production_login_server, build_production_community_server, build_production_mariadb, build_production_nginx]
|
needs: [build_production_frontend, build_production_backend, build_production_login_server, build_production_community_server, build_production_mariadb, build_production_nginx]
|
||||||
env:
|
env:
|
||||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
@ -212,13 +249,20 @@ jobs:
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
# DOWNLOAD DOCKER IMAGES #################################################
|
# DOWNLOAD DOCKER IMAGES #################################################
|
||||||
##########################################################################
|
##########################################################################
|
||||||
- name: Download Docker Image (Neo4J)
|
- name: Download Docker Image (Frontend)
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: docker-frontend-production
|
name: docker-frontend-production
|
||||||
path: /tmp
|
path: /tmp
|
||||||
- name: Load Docker Image
|
- name: Load Docker Image
|
||||||
run: docker load < /tmp/frontend.tar
|
run: docker load < /tmp/frontend.tar
|
||||||
|
- name: Download Docker Image (Backend)
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: docker-backend-production
|
||||||
|
path: /tmp
|
||||||
|
- name: Load Docker Image
|
||||||
|
run: docker load < /tmp/backend.tar
|
||||||
- name: Download Docker Image (Login Server)
|
- name: Download Docker Image (Login Server)
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v2
|
||||||
with:
|
with:
|
||||||
@ -254,6 +298,8 @@ jobs:
|
|||||||
run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
|
run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
|
||||||
- name: Push frontend
|
- name: Push frontend
|
||||||
run: docker push --all-tags gradido/frontend
|
run: docker push --all-tags gradido/frontend
|
||||||
|
- name: Push backend
|
||||||
|
run: docker push --all-tags gradido/backend
|
||||||
- name: Push login_server
|
- name: Push login_server
|
||||||
run: docker push --all-tags gradido/login_server
|
run: docker push --all-tags gradido/login_server
|
||||||
- name: Push community_server
|
- name: Push community_server
|
||||||
|
|||||||
55
.github/workflows/test.yml
vendored
55
.github/workflows/test.yml
vendored
@ -30,6 +30,32 @@ jobs:
|
|||||||
name: docker-frontend-test
|
name: docker-frontend-test
|
||||||
path: /tmp/frontend.tar
|
path: /tmp/frontend.tar
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# JOB: DOCKER BUILD TEST BACKEND #############################################
|
||||||
|
##############################################################################
|
||||||
|
build_test_backend:
|
||||||
|
name: Docker Build Test - Backend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
#needs: [nothing]
|
||||||
|
steps:
|
||||||
|
##########################################################################
|
||||||
|
# CHECKOUT CODE ##########################################################
|
||||||
|
##########################################################################
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
##########################################################################
|
||||||
|
# FRONTEND ###############################################################
|
||||||
|
##########################################################################
|
||||||
|
- name: Backend | Build `test` image
|
||||||
|
run: |
|
||||||
|
docker build --target test -t "gradido/backend:test" backend/
|
||||||
|
docker save "gradido/backend:test" > /tmp/backend.tar
|
||||||
|
- name: Upload Artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: docker-backend-test
|
||||||
|
path: /tmp/backend.tar
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# JOB: DOCKER BUILD TEST LOGIN SERVER ########################################
|
# JOB: DOCKER BUILD TEST LOGIN SERVER ########################################
|
||||||
##############################################################################
|
##############################################################################
|
||||||
@ -159,6 +185,35 @@ jobs:
|
|||||||
- name: frontend | Lint
|
- name: frontend | Lint
|
||||||
run: docker run --rm gradido/frontend:test yarn run lint
|
run: docker run --rm gradido/frontend:test yarn run lint
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# JOB: LINT BACKEND #########################################################
|
||||||
|
##############################################################################
|
||||||
|
lint_backend:
|
||||||
|
name: Lint - Backend
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [build_test_backend]
|
||||||
|
steps:
|
||||||
|
##########################################################################
|
||||||
|
# CHECKOUT CODE ##########################################################
|
||||||
|
##########################################################################
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
##########################################################################
|
||||||
|
# DOWNLOAD DOCKER IMAGE ##################################################
|
||||||
|
##########################################################################
|
||||||
|
- name: Download Docker Image (Backend)
|
||||||
|
uses: actions/download-artifact@v2
|
||||||
|
with:
|
||||||
|
name: docker-backend-test
|
||||||
|
path: /tmp
|
||||||
|
- name: Load Docker Image
|
||||||
|
run: docker load < /tmp/backend.tar
|
||||||
|
##########################################################################
|
||||||
|
# LINT FRONTEND ###########################################################
|
||||||
|
##########################################################################
|
||||||
|
- name: backend | Lint
|
||||||
|
run: docker run --rm gradido/backend:test yarn run lint
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# JOB: UNIT TEST FRONTEND ###################################################
|
# JOB: UNIT TEST FRONTEND ###################################################
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|||||||
@ -21,6 +21,24 @@ services:
|
|||||||
# bind the local folder to the docker to allow live reload
|
# bind the local folder to the docker to allow live reload
|
||||||
- ./frontend:/app
|
- ./frontend:/app
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
# BACKEND ##############################################
|
||||||
|
########################################################
|
||||||
|
backend:
|
||||||
|
image: gradido/backend:development
|
||||||
|
build:
|
||||||
|
target: development
|
||||||
|
networks:
|
||||||
|
- external-net
|
||||||
|
environment:
|
||||||
|
- NODE_ENV="development"
|
||||||
|
volumes:
|
||||||
|
# This makes sure the docker container has its own node modules.
|
||||||
|
# Therefore it is possible to have a different node version on the host machine
|
||||||
|
- backend_node_modules:/app/node_modules
|
||||||
|
# bind the local folder to the docker to allow live reload
|
||||||
|
- ./backend:/app
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
## LOGIN SERVER #########################################
|
## LOGIN SERVER #########################################
|
||||||
#########################################################
|
#########################################################
|
||||||
@ -99,4 +117,5 @@ services:
|
|||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
frontend_node_modules:
|
frontend_node_modules:
|
||||||
login_build_ubuntu_3.1:
|
backend_node_modules:
|
||||||
|
login_build_ubuntu_3.1:
|
||||||
@ -47,7 +47,31 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 3306:3306
|
- 3306:3306
|
||||||
volumes:
|
volumes:
|
||||||
- db_vol:/var/lib/mysql
|
- db_vol:/var/lib/mysql
|
||||||
|
|
||||||
|
########################################################
|
||||||
|
# BACKEND ##############################################
|
||||||
|
########################################################
|
||||||
|
backend:
|
||||||
|
image: gradido/backend:latest
|
||||||
|
build:
|
||||||
|
context: ./backend
|
||||||
|
target: production
|
||||||
|
networks:
|
||||||
|
- internal-net
|
||||||
|
ports:
|
||||||
|
- 4000:4000
|
||||||
|
environment:
|
||||||
|
# Envs used in Dockerfile
|
||||||
|
# - DOCKER_WORKDIR="/app"
|
||||||
|
# - PORT=4000
|
||||||
|
- BUILD_DATE
|
||||||
|
- BUILD_VERSION
|
||||||
|
- BUILD_COMMIT
|
||||||
|
- NODE_ENV="production"
|
||||||
|
# Application only envs
|
||||||
|
#env_file:
|
||||||
|
# - ./frontend/.env
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
## LOGIN SERVER #########################################
|
## LOGIN SERVER #########################################
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user