Skip to content

Commit b78aeab

Browse files
authored
Merge pull request #61 from lungria/feature/migrate-to-multiarch
Feature/migrate to multiarch
2 parents 894f191 + c166381 commit b78aeab

File tree

7 files changed

+106
-392
lines changed

7 files changed

+106
-392
lines changed

.github/workflows/pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-20.04
1010
services:
1111
postgres:
12-
image: postgres
12+
image: postgres:14
1313
env:
1414
# Must be set to any custom value except the default 'postgres'. If default value is used - for some reason
1515
# we would not be able to connect to new dynamically created databases in runtime.
@@ -26,7 +26,7 @@ jobs:
2626
- name: Set up Go 1.x
2727
uses: actions/setup-go@v2
2828
with:
29-
go-version: ^1.15
29+
go-version: ^1.17
3030
id: go
3131

3232
- name: Check out code into the Go module directory
@@ -50,4 +50,4 @@ jobs:
5050
- name: golangci-lint
5151
uses: golangci/golangci-lint-action@v2
5252
with:
53-
version: v1.41.1
53+
version: v1.42.1
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,38 @@
1-
name: main
1+
name: tag
22

33
on:
44
push:
5-
branches: [ main ]
5+
tags:
6+
- v*
67

78
jobs:
89
build:
910
runs-on: ubuntu-20.04
1011
env:
1112
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
1213
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
13-
steps:
14+
steps:
1415
- name: Checkout
1516
uses: actions/checkout@v2
16-
17-
- name: Set up QEMU
18-
uses: docker/setup-qemu-action@v1
19-
with:
20-
platforms: arm64
2117

2218
- name: Set up Docker Buildx
2319
id: buildx
2420
uses: docker/setup-buildx-action@v1
2521
with:
2622
version: latest
27-
23+
2824
- name: Login to DockerHub
2925
uses: docker/login-action@v1
3026
with:
3127
username: ${{ secrets.DOCKER_USERNAME }}
3228
password: ${{ secrets.DOCKER_TOKEN }}
3329

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

3533
- name: Build and push
3634
uses: docker/build-push-action@v2
3735
with:
38-
platforms: linux/arm64
36+
platforms: linux/arm64,linux/amd64
3937
push: true
40-
tags: suddengunter/spendshelf-backend:latest
38+
tags: suddengunter/spendshelf-backend:${{ env.TAG }}

.golangci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,17 @@ linters:
3939
enable:
4040
- dogsled
4141
- gocognit
42-
- maligned
4342
- gocyclo
4443
- gofumpt
45-
- golint
44+
- revive
4645
- lll
4746
- wsl
4847
- misspell
4948
- nestif
5049
- noctx # Doesn't have any config for linters-settings section.
5150
- prealloc
5251
- testpackage
52+
- govet
5353
issues:
5454
include:
5555
# Disable excluding of issues about comments from golint.

Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
FROM golang:1.16.6-alpine3.14 as builder
1+
FROM golang:1.17.1-alpine3.14 as builder
2+
3+
ARG TARGETOS
4+
ARG TARGETARCH
5+
6+
ENV GOOS $TARGETOS
7+
ENV GOARCH $TARGETARCH
8+
ENV CGO_ENABLED 0
29

310
WORKDIR /src
11+
12+
COPY go.mod .
13+
COPY go.sum .
14+
RUN go mod download
15+
416
COPY . ./
517

618
RUN go build -o /spendshelf-backend

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# docker-compose for local debugging
2-
version: '3.1'
2+
version: '3.8'
33

44
services:
55

66
db:
7-
image: postgres
7+
image: postgres:14.0
88
restart: always
99
ports:
1010
- 5432:5432

go.mod

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,42 @@
11
module github.com/lungria/spendshelf-backend
22

3-
go 1.16
3+
go 1.17
44

55
require (
6-
github.com/caarlos0/env/v6 v6.6.2
7-
github.com/gin-gonic/gin v1.7.2
8-
github.com/go-playground/validator/v10 v10.7.0 // indirect
9-
github.com/golang/protobuf v1.5.2 // indirect
6+
github.com/caarlos0/env/v6 v6.7.1
7+
github.com/gin-gonic/gin v1.7.4
108
github.com/google/wire v0.5.0
11-
github.com/jackc/pgx/v4 v4.12.0
12-
github.com/json-iterator/go v1.1.11 // indirect
13-
github.com/leodido/go-urn v1.2.1 // indirect
14-
github.com/mattn/go-isatty v0.0.13 // indirect
9+
github.com/jackc/pgx/v4 v4.13.0
1510
github.com/rs/cors v1.8.0
16-
github.com/rs/zerolog v1.23.0
11+
github.com/rs/zerolog v1.25.0
1712
github.com/stretchr/testify v1.7.0
18-
github.com/ugorji/go v1.2.6 // indirect
13+
)
14+
15+
require (
16+
github.com/davecgh/go-spew v1.1.1 // indirect
17+
github.com/gin-contrib/sse v0.1.0 // indirect
18+
github.com/go-playground/locales v0.14.0 // indirect
19+
github.com/go-playground/universal-translator v0.18.0 // indirect
20+
github.com/go-playground/validator/v10 v10.4.1 // indirect
21+
github.com/golang/protobuf v1.3.3 // indirect
22+
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
23+
github.com/jackc/pgconn v1.10.0 // indirect
24+
github.com/jackc/pgio v1.0.0 // indirect
25+
github.com/jackc/pgpassfile v1.0.0 // indirect
26+
github.com/jackc/pgproto3/v2 v2.1.1 // indirect
27+
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
28+
github.com/jackc/pgtype v1.8.1 // indirect
29+
github.com/jackc/puddle v1.1.3 // indirect
30+
github.com/json-iterator/go v1.1.9 // indirect
31+
github.com/leodido/go-urn v1.2.0 // indirect
32+
github.com/mattn/go-isatty v0.0.12 // indirect
33+
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
34+
github.com/modern-go/reflect2 v1.0.2 // indirect
35+
github.com/pmezard/go-difflib v1.0.0 // indirect
36+
github.com/ugorji/go/codec v1.1.7 // indirect
1937
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
20-
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
21-
google.golang.org/protobuf v1.27.1 // indirect
22-
gopkg.in/yaml.v2 v2.4.0 // indirect
38+
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
39+
golang.org/x/text v0.3.6 // indirect
40+
gopkg.in/yaml.v2 v2.2.8 // indirect
41+
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
2342
)

0 commit comments

Comments
 (0)