Skip to content

Commit 14340fe

Browse files
chr 81 upgrade docker golang versions (#38)
- **feat(dockerfile): upgrade to latest version og golang image** - **chore(mod): upgrade mod to latest golang version** - **chore(compose): update tags for image**
1 parent bd22da2 commit 14340fe

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

Dockerfile

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
################################################################################
1010
# Create a stage for building the application.
11-
ARG GO_VERSION=1.23.0
11+
ARG GO_VERSION=1.23.4
1212
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION} AS build
1313
WORKDIR /src
1414

@@ -17,9 +17,9 @@ WORKDIR /src
1717
# Leverage bind mounts to go.sum and go.mod to avoid having to copy them into
1818
# the container.
1919
RUN --mount=type=cache,target=/go/pkg/mod/ \
20-
--mount=type=bind,source=go.sum,target=go.sum \
21-
--mount=type=bind,source=go.mod,target=go.mod \
22-
go mod download -x
20+
--mount=type=bind,source=go.sum,target=go.sum \
21+
--mount=type=bind,source=go.mod,target=go.mod \
22+
go mod download -x
2323

2424
# This is the architecture you're building for, which is passed in by the builder.
2525
# Placing it here allows the previous steps to be cached across architectures.
@@ -30,8 +30,8 @@ ARG TARGETARCH
3030
# Leverage a bind mount to the current directory to avoid having to copy the
3131
# source code into the container.
3232
RUN --mount=type=cache,target=/go/pkg/mod/ \
33-
--mount=type=bind,target=. \
34-
CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin/server .
33+
--mount=type=bind,target=. \
34+
CGO_ENABLED=0 GOARCH=$TARGETARCH go build -o /bin/server .
3535

3636
################################################################################
3737
# Create a new stage for running the application that contains the minimal
@@ -49,23 +49,23 @@ FROM alpine:latest AS final
4949
# Install any runtime dependencies that are needed to run your application.
5050
# Leverage a cache mount to /var/cache/apk/ to speed up subsequent builds.
5151
RUN --mount=type=cache,target=/var/cache/apk \
52-
apk --update add \
53-
ca-certificates \
54-
tzdata \
55-
&& \
56-
update-ca-certificates
52+
apk --update add \
53+
ca-certificates \
54+
tzdata \
55+
&& \
56+
update-ca-certificates
5757

5858
# Create a non-privileged user that the app will run under.
5959
# See https://docs.docker.com/go/dockerfile-user-best-practices/
6060
ARG UID=10001
6161
RUN adduser \
62-
--disabled-password \
63-
--gecos "" \
64-
--home "/nonexistent" \
65-
--shell "/sbin/nologin" \
66-
--no-create-home \
67-
--uid "${UID}" \
68-
appuser
62+
--disabled-password \
63+
--gecos "" \
64+
--home "/nonexistent" \
65+
--shell "/sbin/nologin" \
66+
--no-create-home \
67+
--uid "${UID}" \
68+
appuser
6969
USER appuser
7070

7171
# Copy the executable from the "build" stage.

compose.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ services:
1414
context: .
1515
target: final
1616
tags:
17-
- pih-core-go:latest
18-
- pih-core-go:0.1.0
17+
- christofflinde/pih-core-go:latest
18+
- christofflinde/pih-core-go:0.1.2
1919
env_file:
2020
- .env
2121
ports:
@@ -52,4 +52,3 @@ services:
5252
# secrets:
5353
# db-password:
5454
# file: db/password.txt
55-

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/christoff-linde/pih-core-go
22

3-
go 1.23.0
3+
go 1.23.4
44

55
require (
66
github.com/gin-gonic/gin v1.10.0

0 commit comments

Comments
 (0)