2021-04-24 10:20:12 +02:00
|
|
|
---
|
|
|
|
name: Build Docker images for all OpenSlides services
|
2021-07-16 16:36:39 +02:00
|
|
|
on: [push, workflow_dispatch]
|
|
|
|
|
2021-04-24 10:20:12 +02:00
|
|
|
env:
|
|
|
|
IMAGE_VERSION: 4.0.0-dev
|
2021-09-23 18:54:23 +02:00
|
|
|
TAG_SUFFIX: -$(date +%Y%m%d)-${GITHUB_SHA::7}
|
2021-04-24 10:20:12 +02:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
name: Builds Docker images
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
service:
|
|
|
|
- name: openslides-proxy
|
|
|
|
directory: proxy
|
|
|
|
|
|
|
|
- name: openslides-client
|
|
|
|
directory: openslides-client
|
|
|
|
|
|
|
|
- name: openslides-backend
|
|
|
|
directory: openslides-backend
|
|
|
|
|
|
|
|
- name: openslides-datastore-reader
|
|
|
|
directory: openslides-datastore-service
|
|
|
|
args:
|
|
|
|
MODULE: reader
|
|
|
|
PORT: 9010
|
|
|
|
|
|
|
|
- name: openslides-datastore-writer
|
|
|
|
directory: openslides-datastore-service
|
|
|
|
args:
|
|
|
|
MODULE: writer
|
|
|
|
PORT: 9011
|
|
|
|
|
|
|
|
- name: openslides-autoupdate
|
|
|
|
directory: openslides-autoupdate-service
|
|
|
|
|
|
|
|
- name: openslides-auth
|
|
|
|
directory: openslides-auth-service
|
|
|
|
|
2021-06-30 16:03:10 +02:00
|
|
|
- name: openslides-icc
|
|
|
|
directory: openslides-icc-service
|
|
|
|
|
2021-04-24 10:20:12 +02:00
|
|
|
- name: openslides-media
|
|
|
|
directory: openslides-media-service
|
|
|
|
|
|
|
|
- name: openslides-manage
|
|
|
|
directory: openslides-manage-service
|
|
|
|
|
|
|
|
steps:
|
2021-07-16 16:36:39 +02:00
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
|
|
|
|
- name: Build image
|
|
|
|
working-directory: ${{ matrix.service.directory }}
|
|
|
|
env:
|
|
|
|
DOCKER_BUILDKIT: 1
|
|
|
|
run: |
|
2021-09-23 18:54:23 +02:00
|
|
|
if [ "${{ matrix.service.name }}" = "openslides-client" ]
|
|
|
|
then
|
2021-09-24 11:08:14 +02:00
|
|
|
eval echo ${IMAGE_VERSION}${TAG_SUFFIX} > client/src/assets/version.txt
|
2021-09-23 18:54:23 +02:00
|
|
|
fi
|
2021-07-16 16:36:39 +02:00
|
|
|
if [ "${{ matrix.service.args }}" != "" ]
|
|
|
|
then
|
|
|
|
export BUILD_ARGS="--build-arg MODULE=${{ matrix.service.args.MODULE }}
|
|
|
|
--build-arg PORT=${{ matrix.service.args.PORT }}"
|
|
|
|
fi
|
|
|
|
docker build . --tag ${{ matrix.service.name }} $BUILD_ARGS
|
|
|
|
|
|
|
|
- name: Log into registry
|
|
|
|
run: echo "${{ secrets.GITHUB_TOKEN }}" |
|
|
|
|
docker login ghcr.io --username ${{ github.actor }} --password-stdin
|
|
|
|
|
|
|
|
- name: Push image
|
|
|
|
run: |
|
|
|
|
IMAGE_ID=ghcr.io/${{ github.repository }}/${{ matrix.service.name }}
|
|
|
|
|
|
|
|
# Change all uppercase to lowercase
|
|
|
|
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
|
|
|
|
2021-09-23 18:54:23 +02:00
|
|
|
docker tag ${{ matrix.service.name }} ${IMAGE_ID}:$(eval echo ${IMAGE_VERSION}${TAG_SUFFIX})
|
|
|
|
docker tag ${{ matrix.service.name }} ${IMAGE_ID}:latest
|
|
|
|
docker push ${IMAGE_ID}:$(eval echo ${IMAGE_VERSION}${TAG_SUFFIX})
|
|
|
|
docker push ${IMAGE_ID}:latest
|