diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c83d8a66..7adf8c31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,8 +49,11 @@ jobs: name: runner / check-dependencies runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-go@v2 + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version: '1.21.4' + check-latest: true - name: WriteGoList run: go list -json -m all > go.list - name: Nancy @@ -62,9 +65,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: actions/setup-go@v2 + - uses: actions/setup-go@v4 with: - go-version: 1.21.x + go-version: '1.21.4' + check-latest: true - name: Unit Tests run: "go test \ diff --git a/Dockerfile b/Dockerfile index 8ac5a054..be92c2ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,21 @@ -# Step 1: Modules caching -FROM golang:alpine as modules -COPY go.mod go.sum /modules/ -WORKDIR /modules -RUN go mod download - -# Step 2: Builder -FROM golang:alpine as builder -COPY --from=modules /go/pkg /go/pkg -COPY . /app -WORKDIR /app -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ - go build -tags migrate -o /bin/app ./cmd/app - -# Step 3: Final -FROM scratch -COPY --from=builder /app/config /config -COPY --from=builder /app/migrations /migrations -COPY --from=builder /bin/app /app -COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +# Step 1: Modules caching +FROM golang:alpine as modules +COPY go.mod go.sum /modules/ +WORKDIR /modules +RUN go mod download + +# Step 2: Builder +FROM golang:alpine as builder +COPY --from=modules /go/pkg /go/pkg +COPY . /app +WORKDIR /app +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ + go build -tags migrate -o /bin/app ./cmd/app + +# Step 3: Final +FROM alpine +COPY --from=builder /app/config /config +COPY --from=builder /app/migrations /migrations +COPY --from=builder /bin/app /app +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ CMD ["/app"] \ No newline at end of file diff --git a/go.mod b/go.mod index d1a82824..d136757e 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module go-clean-template -go 1.21 - -toolchain go1.21.4 +go 1.21.4 require ( github.com/Conight/go-googletrans v0.2.4