Skip to content

Commit

Permalink
Merge pull request #61 from lungria/feature/migrate-to-multiarch
Browse files Browse the repository at this point in the history
Feature/migrate to multiarch
  • Loading branch information
flerka authored Oct 7, 2021
2 parents 894f191 + c166381 commit b78aeab
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 392 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-20.04
services:
postgres:
image: postgres
image: postgres:14
env:
# Must be set to any custom value except the default 'postgres'. If default value is used - for some reason
# we would not be able to connect to new dynamically created databases in runtime.
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: ^1.15
go-version: ^1.17
id: go

- name: Check out code into the Go module directory
Expand All @@ -50,4 +50,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.41.1
version: v1.42.1
20 changes: 9 additions & 11 deletions .github/workflows/main.yml → .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,38 @@
name: main
name: tag

on:
push:
branches: [ main ]
tags:
- v*

jobs:
build:
runs-on: ubuntu-20.04
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
steps:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: arm64

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
version: latest

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Get the tag name
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV

- name: Build and push
uses: docker/build-push-action@v2
with:
platforms: linux/arm64
platforms: linux/arm64,linux/amd64
push: true
tags: suddengunter/spendshelf-backend:latest
tags: suddengunter/spendshelf-backend:${{ env.TAG }}
4 changes: 2 additions & 2 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ linters:
enable:
- dogsled
- gocognit
- maligned
- gocyclo
- gofumpt
- golint
- revive
- lll
- wsl
- misspell
- nestif
- noctx # Doesn't have any config for linters-settings section.
- prealloc
- testpackage
- govet
issues:
include:
# Disable excluding of issues about comments from golint.
Expand Down
14 changes: 13 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
FROM golang:1.16.6-alpine3.14 as builder
FROM golang:1.17.1-alpine3.14 as builder

ARG TARGETOS
ARG TARGETARCH

ENV GOOS $TARGETOS
ENV GOARCH $TARGETARCH
ENV CGO_ENABLED 0

WORKDIR /src

COPY go.mod .
COPY go.sum .
RUN go mod download

COPY . ./

RUN go build -o /spendshelf-backend
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# docker-compose for local debugging
version: '3.1'
version: '3.8'

services:

db:
image: postgres
image: postgres:14.0
restart: always
ports:
- 5432:5432
Expand Down
47 changes: 33 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,42 @@
module github.com/lungria/spendshelf-backend

go 1.16
go 1.17

require (
github.com/caarlos0/env/v6 v6.6.2
github.com/gin-gonic/gin v1.7.2
github.com/go-playground/validator/v10 v10.7.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/caarlos0/env/v6 v6.7.1
github.com/gin-gonic/gin v1.7.4
github.com/google/wire v0.5.0
github.com/jackc/pgx/v4 v4.12.0
github.com/json-iterator/go v1.1.11 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/jackc/pgx/v4 v4.13.0
github.com/rs/cors v1.8.0
github.com/rs/zerolog v1.23.0
github.com/rs/zerolog v1.25.0
github.com/stretchr/testify v1.7.0
github.com/ugorji/go v1.2.6 // indirect
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/golang/protobuf v1.3.3 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.10.0 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.8.1 // indirect
github.com/jackc/puddle v1.1.3 // indirect
github.com/json-iterator/go v1.1.9 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
golang.org/x/text v0.3.6 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit b78aeab

Please sign in to comment.