-
Notifications
You must be signed in to change notification settings - Fork 22
63 lines (52 loc) · 2 KB
/
docker-build-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Github action to build and publish a Docker image
#
name: build and publish docker
on:
pull_request:
branches:
- 'master'
push:
branches:
- 'master'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Disable apparmor
run: |
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- name: Build the docker image
run: docker build --rm -t surfnet/centos7-openconext-ga -f tests/Dockerfile.centos-7-ga .
- name: Run Ansible on the Docker container to install OpenConext
run: sh tests/githubactions-build.sh
- name: Check other issues
if: ${{ failure() }}
run: |
docker exec ansible-test-ga cat /var/log/messages
docker exec ansible-test-ga cat /var/log/manage/manage.log
docker exec systemctl status haproxy
- name: Set branch name
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
- name: Set branch name on pull_request
if: github.event_name == 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF} | sed 's/\//_/g')" >> $GITHUB_ENV
- name: Commit and tag the Docker image
run: |
DOCKER_COMMIT_SHA=$(docker commit ansible-test-ga)
docker tag $DOCKER_COMMIT_SHA ghcr.io/openconext/openconext-deploy/openconext-core:${{ env.BRANCH_NAME }}
- name: Show the docker image
run: docker images
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_CONTAINER_REGISTRY_PAT }}
- name: Push the image
run: docker push ghcr.io/openconext/openconext-deploy/openconext-core:${{ env.BRANCH_NAME }}