mirror of https://github.com/docker/docs.git
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:
parent
62aae99eb0
commit
ed1f51dde2
|
@ -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
|
||||
```
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue