From 101cb416a1ec9eaca51d9b42319c6240daf146ee Mon Sep 17 00:00:00 2001 From: mugioka Date: Sat, 30 Mar 2024 17:18:20 +0900 Subject: [PATCH] feat: build and push container image to GHCR. Signed-off-by: mugioka --- .github/workflows/{build.yml => test.yml} | 19 +++++++++---------- Dockerfile | 4 ++-- Dockerfile.local | 2 +- docker-compose.mongo-replica.yml | 4 +--- docker-compose.mxt-local.yml | 5 ++--- 5 files changed, 15 insertions(+), 19 deletions(-) rename .github/workflows/{build.yml => test.yml} (69%) diff --git a/.github/workflows/build.yml b/.github/workflows/test.yml similarity index 69% rename from .github/workflows/build.yml rename to .github/workflows/test.yml index db4464f..a463a47 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/test.yml @@ -1,24 +1,23 @@ -name: Build +name: CI on: - push: - branches: - - '**' + # push: + # branches: + # - '**' pull_request: - types: [opened, reopened] jobs: - sonarcloud: - name: SonarCloud + test: + name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4.1.1 with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v2 + uses: actions/setup-go@v5.0.0 with: - go-version: 1.17 + go-version: 1.22.1 - name: Test run: go test --tags=test -coverprofile=cover.out $(go list ./... | grep -v mxtransporter/cmd) diff --git a/Dockerfile b/Dockerfile index ba20844..c9272b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ## ## Build ## -FROM golang:latest as build +FROM golang:1.22.1-bookworm as build LABEL org.opencontainers.image.source="https://github.com/cam-inc/MxTransporter" @@ -24,7 +24,7 @@ RUN go install ./cmd/health.go ## ## Deploy ## -FROM alpine:latest +FROM alpine:3.19.1 WORKDIR /go/src diff --git a/Dockerfile.local b/Dockerfile.local index 73e4a90..127b205 100644 --- a/Dockerfile.local +++ b/Dockerfile.local @@ -1,4 +1,4 @@ -FROM golang:latest +FROM golang:1.22.1-bookworm WORKDIR /go/src diff --git a/docker-compose.mongo-replica.yml b/docker-compose.mongo-replica.yml index c18ca63..f5ee92a 100644 --- a/docker-compose.mongo-replica.yml +++ b/docker-compose.mongo-replica.yml @@ -1,7 +1,6 @@ version: '3.8' services: - mongodb-primary: image: mongo command: @@ -22,7 +21,7 @@ services: mongodb-secondary: image: mongo - command: + command: - --replSet - rs0 volumes: @@ -39,4 +38,3 @@ services: expose: - 27017 restart: always - diff --git a/docker-compose.mxt-local.yml b/docker-compose.mxt-local.yml index f984485..0bf70aa 100644 --- a/docker-compose.mxt-local.yml +++ b/docker-compose.mxt-local.yml @@ -1,7 +1,6 @@ version: '3.8' services: - mxt: build: context: '.' @@ -21,12 +20,12 @@ services: extends: file: docker-compose.mongo-replica.yml service: mongodb-primary - + mongodb-secondary: extends: file: docker-compose.mongo-replica.yml service: mongodb-secondary - + mongodb-arbiter: extends: file: docker-compose.mongo-replica.yml