build: use a site param for example alpine versions

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2024-02-01 16:58:46 +01:00
parent 62aae99eb0
commit ed1f51dde2
4 changed files with 8 additions and 9 deletions

View File

@ -193,7 +193,7 @@ cURL installed for multiple architectures:
```dockerfile
# syntax=docker/dockerfile:1
FROM alpine:3.16
FROM alpine:{{% param "example_alpine_version" %}}
RUN apk add curl
```

View File

@ -1,10 +1,8 @@
---
title: Multi-stage builds
description: 'Learn about multi-stage builds and how you can use
description: |
Learn about multi-stage builds and how you can use
them to improve your builds and get smaller images
'
keywords: build, best practices
aliases:
- /engine/userguide/eng-image/multistage-build/
@ -22,11 +20,11 @@ stage of the build. You can selectively copy artifacts from one stage to
another, leaving behind everything you don't want in the final image.
The following Dockerfile has two separate stages: one for building a binary,
and another where we copy the binary into.
and another where the binary gets copied from the first stage into the next stage.
```dockerfile
# syntax=docker/dockerfile:1
FROM golang:1.21
FROM golang:{{% param "example_go_version" %}}
WORKDIR /src
COPY <<EOF ./main.go
package main
@ -71,7 +69,7 @@ Dockerfile are re-ordered later, the `COPY` doesn't break.
```dockerfile
# syntax=docker/dockerfile:1
FROM golang:1.21 as build
FROM golang:{{% param "example_go_version" %}} as build
WORKDIR /src
COPY <<EOF /src/main.go
package main

View File

@ -42,7 +42,7 @@ jobs:
with:
context: .
build-contexts: |
alpine=docker-image://alpine:3.16
alpine=docker-image://alpine:{{% param "example_alpine_version" %}}
tags: myimage:latest
```

View File

@ -100,6 +100,7 @@ params:
example_go_version: "1.21"
example_golangci_lint_version: "v1.52"
example_alpine_version: "1.19"
min_api_threshold: 1.41