Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Publication Docker image

on: [push]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
id: buildx
- name: Cache Docker Image Layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and Push Docker Image
uses: docker/build-push-action@v2
id: docker_build
with:
context: ./
file: ./Dockerfile
builder: ${{ steps.buildx.outputs.name }}
platforms: linux/amd64, linux/arm64, linux/aarch64
push: true
tags: ${{ secrets.DOCKER_USERNAME }}/imaginaryprototype:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
- name: Verify
run: echo ${{ steps.docker_build.outputs.digest }}
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ RUN go mod download
COPY . .

# Run quality control
RUN go test ./... -test.v -race -test.coverprofile=atomic .
# RUN go test ./... -test.v -race -test.coverprofile=atomic .
ARG TARGETPLATFORM
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ] ; then go test ./... -test.v -test.coverprofile=atomic . ; else go test ./... -test.v -race -test.coverprofile=atomic . ; fi
RUN golangci-lint run .

# Compile imaginary
Expand Down