Skip to content

Commit 726080c

Browse files
committed
docs: Update golang guide to include Docker Hardened Images
1 parent 2f5d48e commit 726080c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

content/guides/golang/build-images.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Choosing DHI offers the advantage of a production-ready image that is lightweigh
107107
{{< tab name="Using Docker Hardened Images" >}}
108108
Docker Hardened Images (DHIs) are available for Go on [Docker Hub](https://hub.docker.com/hardened-images/catalog/dhi/golang). Unlike using the Docker Official Image, you must first mirror the Go image into your organization and then use it as your base image. Follow the instructions in the [DHI quickstart](/dhi/get-started/) to create a mirrored repository for Go.
109109

110-
Mirrored repositories must start with `dhi-`, for example: `FROM <your-namespace>/dhi-golang:<tag>`. In the following Dockerfile, the `FROM` instruction uses `<your-namespace>/dhi-golang:1.19` as the base image.
110+
Mirrored repositories must start with `dhi-`, for example: `FROM <your-namespace>/dhi-golang:<tag>`. In the following Dockerfile, the `FROM` instruction uses `<your-namespace>/dhi-golang:1.25` as the base image.
111111

112112
Begin your `Dockerfile` with the (optional) parser directive line that instructs BuildKit to
113113
interpret your file according to the grammar rules for the specified version of the syntax.
@@ -117,7 +117,7 @@ You then tell Docker what base image you would like to use for your application:
117117
```dockerfile
118118
# syntax=docker/dockerfile:1
119119

120-
FROM <your-namespace>/dhi-golang:1.19
120+
FROM <your-namespace>/dhi-golang:1.25
121121
```
122122

123123
Docker images can be inherited from other images. Therefore, instead of creating
@@ -127,7 +127,7 @@ has all necessary tools and libraries to compile and run a Go application.
127127
{{< /tab >}}
128128
{{< tab name="Using the official image" >}}
129129

130-
Using the Docker Official Image is straightforward. In the following Dockerfile, you'll notice that the `FROM` instruction uses `golang:1.19` as the base image.
130+
Using the Docker Official Image is straightforward. In the following Dockerfile, you'll notice that the `FROM` instruction uses `golang:1.25` as the base image.
131131

132132
This is the official image for Go. This image is [available on the Docker Hub](https://hub.docker.com/_/golang).
133133

@@ -139,7 +139,7 @@ You then tell Docker what base image you would like to use for your application:
139139
```dockerfile
140140
# syntax=docker/dockerfile:1
141141

142-
FROM golang:1.19
142+
FROM golang:1.25
143143
```
144144

145145
Docker images can be inherited from other images. Therefore, instead of creating
@@ -206,7 +206,7 @@ directory inside the image.
206206
RUN go mod download
207207
```
208208

209-
At this point, you have a Go toolchain version 1.19.x and all your Go
209+
At this point, you have a Go toolchain version 1.25.x and all your Go
210210
dependencies installed inside the image.
211211

212212
The next thing you need to do is to copy your source code into the image. You’ll
@@ -250,7 +250,7 @@ Here's the complete `Dockerfile`:
250250
```dockerfile
251251
# syntax=docker/dockerfile:1
252252

253-
FROM <your-namespace>/dhi-golang:1.19
253+
FROM <your-namespace>/dhi-golang:1.25
254254

255255
# Set destination for COPY
256256
WORKDIR /app
@@ -283,7 +283,7 @@ CMD ["/docker-gs-ping"]
283283
```dockerfile
284284
# syntax=docker/dockerfile:1
285285

286-
FROM golang:1.19
286+
FROM golang:1.25
287287

288288
# Set destination for COPY
289289
WORKDIR /app
@@ -326,7 +326,7 @@ that you may have used:
326326
# syntax=docker/dockerfile:1
327327
# A sample microservice in Go packaged into a container image.
328328

329-
FROM golang:1.19
329+
FROM golang:1.25
330330

331331
# ...
332332
```
@@ -361,8 +361,8 @@ The following is just an example of what these messages may look like.
361361
=> CACHED docker-image://docker.io/docker/dockerfile:1@sha256:39b85bbfa7536a5feceb7372a0817649ecb2724562a38360f4d6a7782a409b14 0.0s
362362
=> [internal] load build definition from Dockerfile 0.0s
363363
=> [internal] load .dockerignore 0.0s
364-
=> [internal] load metadata for docker.io/library/golang:1.19 0.7s
365-
=> [1/6] FROM docker.io/library/golang:1.19@sha256:5d947843dde82ba1df5ac1b2ebb70b203d106f0423bf5183df3dc96f6bc5a705 0.0s
364+
=> [internal] load metadata for docker.io/library/golang:1.25 0.7s
365+
=> [1/6] FROM docker.io/library/golang:1.25@sha256:5d947843dde82ba1df5ac1b2ebb70b203d106f0423bf5183df3dc96f6bc5a705 0.0s
366366
=> [internal] load build context 0.0s
367367
=> => transferring context: 6.08kB 0.0s
368368
=> CACHED [2/6] WORKDIR /app 0.0s
@@ -504,7 +504,7 @@ following content:
504504
# syntax=docker/dockerfile:1
505505

506506
# Build the application from source
507-
FROM <your-namespace>/dhi-golang:1.19 AS build-stage
507+
FROM <your-namespace>/dhi-golang:1.25 AS build-stage
508508

509509
WORKDIR /app
510510

@@ -540,7 +540,7 @@ ENTRYPOINT ["/docker-gs-ping"]
540540
# syntax=docker/dockerfile:1
541541

542542
# Build the application from source
543-
FROM golang:1.19 AS build-stage
543+
FROM golang:1.25 AS build-stage
544544

545545
WORKDIR /app
546546

0 commit comments

Comments
 (0)