chore(github-workflow): add build and publish docker image workflow
This commit is contained in:
parent
ce6189685a
commit
9a83963cfb
37
.github/workflows/build-docker-image.yaml
vendored
Normal file
37
.github/workflows/build-docker-image.yaml
vendored
Normal 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
17
app/Makefile
Normal 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)
|
Loading…
Reference in New Issue
Block a user