changes to docker pipelines (autobuilds disabled on Docker Hub)

This commit is contained in:
Łukasz Budnik
2021-08-20 14:12:34 +02:00
parent 3af4030d87
commit 0ae522a43e
4 changed files with 67 additions and 26 deletions

View File

@@ -1,18 +1,12 @@
name: Docker Image CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag yosoy-local:$(date +%s)
- uses: actions/checkout@v2.3.4
- name: Build the Docker image
run: docker build . --file Dockerfile --tag yosoy-local:$(date +%s)

52
.github/workflows/docker-publish.yml vendored Normal file
View File

@@ -0,0 +1,52 @@
name: Publish Docker image
on:
push:
branches: [main]
release:
types: [published]
jobs:
push_to_registries:
name: Push Docker image to Docker Hub and ghcr.io registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: |
lukasz/yosoy
ghcr.io/${{ github.repository }}
tags: |
type=raw,value=latest
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push Docker images
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -1,25 +1,20 @@
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/checkout@v2.3.4
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.15
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Build
run: go build -v ./...
- name: Build
run: go build -v ./...
- name: Test
run: go test -v ./...
- name: Test
run: go test -v ./...

2
go.mod
View File

@@ -1,6 +1,6 @@
module github.com/lukaszbudnik/yosoy
go 1.15
go 1.16
require (
github.com/gorilla/handlers v1.5.1