Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@
# the case. Therefore, you don't have to disable it anymore.
#

FROM golang:1.11.11 AS base
# allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org
RUN sed -ri "s/(httpredir|deb).debian.org/$APT_MIRROR/g" /etc/apt/sources.list
ARG GO_VERSION=1.11.12

FROM golang:${GO_VERSION}-stretch AS base
ARG APT_MIRROR
RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \
&& sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list

FROM base AS criu
# Install CRIU for checkpoint/restore support
Expand Down
15 changes: 7 additions & 8 deletions Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
## Step 1: Build tests
FROM golang:1.11.11-alpine3.9 as builder
ARG GO_VERSION=1.11.12

RUN apk add --update \
FROM golang:${GO_VERSION}-alpine3.9 AS builder

RUN apk --no-cache add \
bash \
btrfs-progs-dev \
build-base \
curl \
lvm2-dev \
jq \
&& rm -rf /var/cache/apk/*
jq

RUN mkdir -p /go/src/github.com/docker/docker/
WORKDIR /go/src/github.com/docker/docker/
Expand Down Expand Up @@ -43,16 +43,15 @@ RUN mkdir -p /output/tests && find . -name test.main -exec cp --parents '{}' /ou
FROM alpine:3.9 as runner

# GNU tar is used for generating the emptyfs image
RUN apk add --update \
RUN apk --no-cache add \
bash \
ca-certificates \
g++ \
git \
iptables \
pigz \
tar \
xz \
&& rm -rf /var/cache/apk/*
xz

# Add an unprivileged user to be used for tests which need it
RUN addgroup docker && adduser -D -G docker unprivilegeduser -s /bin/ash
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.simple
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

# This represents the bare minimum required to build and test Docker.

FROM golang:1.11.11-stretch
ARG GO_VERSION=1.11.12

FROM golang:${GO_VERSION}-stretch

# allow replacing httpredir or deb mirror
ARG APT_MIRROR=deb.debian.org
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ FROM microsoft/windowsservercore
# Use PowerShell as the default shell
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]

ARG GO_VERSION=1.11.12

# Environment variable notes:
# - GO_VERSION must be consistent with 'Dockerfile' used by Linux.
# - FROM_DOCKERFILE is used for detection of building within a container.
ENV GO_VERSION=1.11.11 `
ENV GO_VERSION=${GO_VERSION} `
GIT_VERSION=2.11.1 `
GOPATH=C:\go `
FROM_DOCKERFILE=1
Expand Down Expand Up @@ -205,7 +207,7 @@ RUN `
Download-File $location C:\gitsetup.zip; `
`
Write-Host INFO: Downloading go...; `
Download-File $('https://golang.org/dl/go'+$Env:GO_VERSION+'.windows-amd64.zip') C:\go.zip; `
Download-File $('https://golang.org/dl/go'+$Env:GO_VERSION.TrimEnd('.0')"+'.windows-amd64.zip') C:\go.zip; `
`
Write-Host INFO: Downloading compiler 1 of 3...; `
Download-File https://raw.githubusercontent.com/jhowardmsft/docker-tdmgcc/master/gcc.zip C:\gcc.zip; `
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ dynbinary: build ## build the linux dynbinaries
build: DOCKER_BUILDKIT ?= 1
build: bundles
$(warning The docker client CLI has moved to github.com/docker/cli. For a dev-test cycle involving the CLI, run:${\n} DOCKER_CLI_PATH=/host/path/to/cli/binary make shell ${\n} then change the cli and compile into a binary at the same location.${\n})
DOCKER_BUILDKIT="${DOCKER_BUILDKIT}" docker build ${BUILD_APT_MIRROR} ${DOCKER_BUILD_ARGS} ${DOCKER_BUILD_OPTS} -t "$(DOCKER_IMAGE)" -f "$(DOCKERFILE)" .
DOCKER_BUILDKIT="${DOCKER_BUILDKIT}" docker build --build-arg=GO_VERSION ${BUILD_APT_MIRROR} ${DOCKER_BUILD_ARGS} ${DOCKER_BUILD_OPTS} -t "$(DOCKER_IMAGE)" -f "$(DOCKERFILE)" .

bundles:
mkdir bundles
Expand Down
19 changes: 4 additions & 15 deletions hack/ci/windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -426,20 +426,9 @@ Try {
Write-Host -ForegroundColor Green "INFO: Location for testing is $env:TEMP"

# CI Integrity check - ensure Dockerfile.windows and Dockerfile go versions match
$goVersionDockerfileWindows=$(Get-Content ".\Dockerfile.windows" | Select-String "^ENV GO_VERSION" | Select-object -First 1).ToString().Replace("ENV GO_VERSION=","").Replace("\","").Replace("``","").Trim()
$goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "^ENV GO_VERSION" | Select-object -First 1)

# As of go 1.11, Dockerfile changed to be in the format like "FROM golang:1.11.0 AS base".
# If a version number ends with .0 (as in 1.11.0, a convention used in golang docker
# image versions), it needs to be removed (i.e. "1.11.0" becomes "1.11").
if ($null -eq $goVersionDockerfile) {
$goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "^FROM golang:" | Select-object -First 1)
if ($null -ne $goVersionDockerfile) {
$goVersionDockerfile = $goVersionDockerfile.ToString().Split(" ")[1].Split(":")[1] -replace '\.0$',''
}
} else {
$goVersionDockerfile = $goVersionDockerfile.ToString().Split(" ")[2]
}
$goVersionDockerfileWindows=(Select-String -Path ".\Dockerfile.windows" -Pattern "^ARG[\s]+GO_VERSION=(.*)$").Matches.groups[1].Value
$goVersionDockerfile=(Select-String -Path ".\Dockerfile" -Pattern "^ARG[\s]+GO_VERSION=(.*)$").Matches.groups[1].Value

if ($null -eq $goVersionDockerfile) {
Throw "ERROR: Failed to extract golang version from Dockerfile"
}
Expand All @@ -453,7 +442,7 @@ Try {
Write-Host -ForegroundColor Cyan "`n`nINFO: Building the image from Dockerfile.windows at $(Get-Date)..."
Write-Host
$ErrorActionPreference = "SilentlyContinue"
$Duration=$(Measure-Command { docker build -t docker -f Dockerfile.windows . | Out-Host })
$Duration=$(Measure-Command { docker build --build-arg=GO_VERSION -t docker -f Dockerfile.windows . | Out-Host })
$ErrorActionPreference = "Stop"
if (-not($LastExitCode -eq 0)) {
Throw "ERROR: Failed to build image from Dockerfile.windows"
Expand Down
2 changes: 1 addition & 1 deletion hack/make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Function Check-InContainer() {
# outside of a container where it may be out of date with master.
Function Verify-GoVersion() {
Try {
$goVersionDockerfile=(Select-String -Path ".\Dockerfile" -Pattern "^FROM golang:").ToString().Split(" ")[1].SubString(7) -replace '\.0$',''
$goVersionDockerfile=(Select-String -Path ".\Dockerfile" -Pattern "^ARG[\s]+GO_VERSION=(.*)$").Matches.groups[1].Value.TrimEnd(".0")
$goVersionInstalled=(go version).ToString().Split(" ")[2].SubString(2)
}
Catch [Exception] {
Expand Down