chore(github-workflow): add build and publish docker image workflow

This commit is contained in:
Vadim Aleksandrov 2024-07-15 16:28:47 +03:00
parent ce6189685a
commit 9a83963cfb
No known key found for this signature in database
GPG Key ID: 4D3A2E248D54FDAE
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,37 @@
name: Docker image build
on:
push:
branches: [master]
paths:
- app/**
pull_request:
paths:
- app/**
jobs:
build-images:
name: Build docker image
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build test-app
run: make build
working-directory: app
- name: Login to Quay
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
registry: quay.csssr.cloud
username: csssr+github_devops_test_app
password: ${{ secrets.QUAY_REGISTRY_PASSWORD }}
- name: Publish test-app
run: make publish
if: github.event_name == 'push'
working-directory: app

17
app/Makefile Normal file
View File

@ -0,0 +1,17 @@
.PHONY: start build publish
export GOBIN=${CURDIR}/bin
version ?= master
$(GOBIN)/air:
go install github.com/air-verse/air@latest
start: $(GOBIN)/air
air
build:
docker build . --tag quay.csssr.cloud/csssr/test-app:$(version)
publish:
docker push quay.csssr.cloud/csssr/test-app:$(version)