Skip to content

up atlas

up atlas #240

Workflow file for this run

name: Docker
on:
push:
branches:
- main
- develop
- current
pull_request:
branches:
- develop
release:
types: [published]
jobs:
tests:
name: Build containers and process tests
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: True
- name: copy cur environment
run: cp .env.dev.example .env
- name: Copy config samples
run: |
./scripts/init_applications_config.sh .env
- name: Build all images
run: |
./build/build_geonature_all.sh .env
- name: Lauch docker compose
run: |
docker compose up -d
- name: Save Logs in temp file
run: |
docker compose logs -f > /tmp/docker_compose.log &
- name: test containers running
uses: nick-fields/retry@v2
with:
timeout_seconds: 120
max_attempts: 10
retry_wait_seconds: 30
command: |
docker compose ps
nb_services_running=$(docker compose ps --services --filter 'status=running' | wc -l)
nb_services_healthy=$(docker compose ps | grep '(healthy)'| wc -l)
echo nb_services_running $nb_services_running
echo nb_services_healthy $nb_services_healthy
[ "$nb_services_running" = "10" ] || exit 1
[ "$nb_services_healthy" = "6" ] || exit 1
- name: test app response
run: |
./scripts/test_docker_url.sh .env
- name: test reload
run: |
./scripts/test_docker_reload.sh .env
- name: Log if fail
if: ${{ failure() }}
run: |
docker compose logs
cat /tmp/docker_compose.log
docker compose ps
publish:
name: Build and publish dockerimages
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
needs: tests
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: True
- name: Git Sumbodule Update
run: |
cur=$(pwd)
for app in "GeoNature" "GeoNature-atlas" "UsersHub" "TaxHub"; do
cd ./sources/${app}
git submodule init
git submodule update
cd $cur
done
- name: Set Environnement variables
run: |
scripts/init_env.sh >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and export geonature backend wheels image
id: build-wheels
uses: docker/build-push-action@v4
with:
context: ./sources/GeoNature
file: ./sources/GeoNature/backend/Dockerfile
target: wheels
push: true
tags: "${{ env.GN_BACKEND_TAGS }}-wheels"
labels: ${{ env.GN_LABELS }}
- name: Build and export geonature backend image (+ 4 modules)
id: build-prod
uses: docker/build-push-action@v4
with:
context: .
file: ./build/Dockerfile-geonature-backend
target: prod-extra
push: true
tags: "${{ env.GN_BACKEND_TAGS }}"
labels: ${{ env.GN_LABELS }}
build-args: GEONATURE_BACKEND_IMAGE=${{env.GN_BACKEND_IMAGE}}
- name: Build and export frontend source
uses: docker/build-push-action@v4
with:
context: ./sources/GeoNature
file: ./sources/GeoNature/frontend/Dockerfile
target: source
tags: "${{env.GN_FRONTEND_TAGS}}-source"
push: true
- name: Build and export frontend nginx
uses: docker/build-push-action@v4
with:
context: ./sources/GeoNature
file: ./sources/GeoNature/frontend/Dockerfile
target: prod-base
tags: "${{env.GN_FRONTEND_TAGS}}-nginx"
push: true
- name: Build and export frontend + 4 modules
uses: docker/build-push-action@v4
with:
context: .
file: ./build/Dockerfile-geonature-frontend
tags: "${{env.GN_FRONTEND_TAGS}}"
build-args: GEONATURE_FRONTEND_IMAGE=${{env.GN_FRONTEND_IMAGE}}
push: true
- name: Build and export Usershub
uses: docker/build-push-action@v4
with:
context: ./sources/UsersHub
file: ./sources/UsersHub/Dockerfile
tags: "${{env.UH_TAGS}}"
push: true
- name: Build and export TaxHub
uses: docker/build-push-action@v4
with:
context: ./sources/TaxHub
file: ./sources/TaxHub/Dockerfile
tags: "${{env.TH_TAGS}}"
push: true
- name: Build and export GeoNature-atlas
uses: docker/build-push-action@v4
with:
context: ./sources/GeoNature-atlas
file: ./sources/GeoNature-atlas/Dockerfile
tags: "${{env.ATLAS_TAGS}}"
push: true