mirror of https://github.com/docker/docs.git
build: add syntax directives to dockerfile examples
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
71f5322f46
commit
c121f737ef
|
@ -22,6 +22,7 @@ Have a look at the following example, which shows a simple Dockerfile for a
|
|||
program written in C.
|
||||
|
||||
```dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM ubuntu:latest
|
||||
|
||||
RUN apt-get update && apt-get install -y build-essentials
|
||||
|
@ -86,6 +87,7 @@ Consider the following example. A Dockerfile snippet that runs a JavaScript
|
|||
build from the source files in the current directory:
|
||||
|
||||
```dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM node
|
||||
WORKDIR /app
|
||||
COPY . . # Copy over all files in the current directory
|
||||
|
@ -103,6 +105,7 @@ the dependencies. Finally, copy over the project source code, which is subject
|
|||
to frequent change.
|
||||
|
||||
```dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM node
|
||||
WORKDIR /app
|
||||
COPY package.json yarn.lock . # Copy package management files
|
||||
|
@ -225,6 +228,8 @@ illustrates building a simple web server that serves HTML from your `docs`
|
|||
directory in Git:
|
||||
|
||||
```dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# stage 1
|
||||
FROM alpine as git
|
||||
RUN apk add git
|
||||
|
|
|
@ -41,6 +41,7 @@ $ docker build .
|
|||
With the following Dockerfile:
|
||||
|
||||
```dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM busybox
|
||||
WORKDIR /src
|
||||
COPY foo .
|
||||
|
@ -64,6 +65,7 @@ files required by the `COPY` instructions, in this case `foo`.
|
|||
In some cases you may want to send the entire context:
|
||||
|
||||
```dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM busybox
|
||||
WORKDIR /src
|
||||
COPY . .
|
||||
|
|
|
@ -148,6 +148,8 @@ rel="noopener" class="_"} in BuildKit as an example. Feel free to include your
|
|||
own CNI configuration.
|
||||
|
||||
```dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
ARG BUILDKIT_VERSION=v{{ site.buildkit_version }}
|
||||
ARG CNI_VERSION=v1.0.1
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ Here is how to install and use Buildx inside a Dockerfile through the
|
|||
[`docker/buildx-bin`](https://hub.docker.com/r/docker/buildx-bin) image:
|
||||
|
||||
```dockerfile
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM docker
|
||||
COPY --from=docker/buildx-bin:latest /buildx /usr/libexec/docker/cli-plugins/docker-buildx
|
||||
RUN docker buildx version
|
||||
|
|
Loading…
Reference in New Issue