Skip to content

Commit

Permalink
[CONSUL-441] Update windows dockerfile with version
Browse files Browse the repository at this point in the history
  • Loading branch information
ezfepo committed Sep 16, 2022
1 parent 823c7fe commit 38e6133
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
5 changes: 3 additions & 2 deletions Dockerfile-windows
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM mcr.microsoft.com/windows/servercore:1809
ENV VERSION=1.12.0
ARG VERSION=1.13.1

LABEL org.opencontainers.image.authors="Consul Team <[email protected]>" \
org.opencontainers.image.url="https://www.consul.io/" \
Expand All @@ -8,7 +8,8 @@ LABEL org.opencontainers.image.authors="Consul Team <[email protected]>" \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.vendor="HashiCorp" \
org.opencontainers.image.title="consul" \
org.opencontainers.image.description="Consul is a datacenter runtime that provides service discovery, configuration, and orchestration."
org.opencontainers.image.description="Consul is a datacenter runtime that provides service discovery, configuration, and orchestration." \
version=${VERSION}

RUN ["powershell", "Set-ExecutionPolicy", "Bypass", "-Scope", "Process", "-Force;"]
RUN ["powershell", "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))"]
Expand Down
4 changes: 4 additions & 0 deletions build-support-windows/Dockerfile-consul-dev-windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ARG VERSION=1.13.1

FROM windows/consul:${VERSION}-local
COPY dist/ C:\\consul
14 changes: 14 additions & 0 deletions build-support-windows/Dockerfile-consul-dev-windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

cd ../
rm -rf dist

export GOOS=windows GOARCH=amd64
VERSION=1.13.1
CONSUL_BUILDDATE=$(date +"%Y-%m-%dT%H:%M:%SZ")
GIT_IMPORT=github.com/hashicorp/consul/version
GOLDFLAGS=" -X $GIT_IMPORT.Version=$VERSION -X $GIT_IMPORT.VersionPrerelease=dev -X $GIT_IMPORT.BuildDate=$CONSUL_BUILDDATE "

go build -ldflags "$GOLDFLAGS" -o ./dist/ .

docker build -t windows/consul:${VERSION}-dev -f ./build-support-windows/Dockerfile-consul-dev-windows . --build-arg VERSION=${VERSION}
12 changes: 3 additions & 9 deletions build-support-windows/Dockerfile-consul-local-windows
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
ARG ENVOY_VERSION=v1.19.5
ARG CONSUL_IMAGE_VERSION=latest
ARG VERSION=1.13.1

FROM envoyproxy/envoy-windows:${ENVOY_VERSION} as envoy
FROM windows/consul:${CONSUL_IMAGE_VERSION}
COPY dist/ C:\\consul
FROM windows/consul:${VERSION}

# Fortio binary downloaded
RUN mkdir fortio
ENV FORTIO_URL=https://github.com/fortio/fortio/releases/download/v1.33.0/fortio_win_1.33.0.zip
RUN curl %FORTIO_URL% -L -o fortio.zip
RUN tar -xf fortio.zip -C fortio

# Copy envoy.exe from FROM envoyproxy/envoy-windows:${ENVOY_VERSION}
COPY --from=envoy ["C:/Program Files/envoy/", "C:/envoy/"]

RUN choco install openssl -yf
RUN choco install jq -yf
RUN choco install netcat -yf
Expand Down Expand Up @@ -49,4 +43,4 @@ EXPOSE 19000 19001 19002 19003 19004
EXPOSE 21000 21001 21002 21003 21004
EXPOSE 5000 1234 2345

RUN SETX /M path "%PATH%;C:\consul;C:\envoy;C:\fortio;C:\jaeger;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\OpenSSL-Win64\bin;C:\bats\bin\;C:\ProgramData\chocolatey\lib\jq\tools;C:\socat;"
RUN SETX /M path "%PATH%;C:\consul;C:\fortio;C:\jaeger;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\OpenSSL-Win64\bin;C:\bats\bin\;C:\ProgramData\chocolatey\lib\jq\tools;C:\socat;"
14 changes: 0 additions & 14 deletions build-support-windows/Dockerfile-consul-local-windows.sh

This file was deleted.

17 changes: 9 additions & 8 deletions build-support-windows/build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@

readonly HASHICORP_DOCKER_PROXY="docker.mirror.hashicorp.services"

ENVOY_VERSION=${ENVOY_VERSION:-"1.19.5"}
export ENVOY_VERSION
# Build Consul Version 1.13.1 / 1.12.4 / 1.11.8
VERSION=${VERSION:-"1.13.1"}
export VERSION

echo "Building Images"

# Build Windows Consul Image
# Build windows/consul:${VERSION} Image
echo " "
echo "Build Windows Consul Image"
docker build -t "windows/consul" -f ../Dockerfile-windows ../
echo "Build windows/consul:${VERSION} Image"
docker build -t "windows/consul:${VERSION}" -f ../Dockerfile-windows ../ --build-arg VERSION=${VERSION}

# Build Windows Consul:local Image
# Build windows/consul:${VERSION}-local Image
echo " "
echo "Build Windows Consul:local Image"
./Dockerfile-consul-local-windows.sh
echo "Build windows/consul:${VERSION}-local Image"
docker build -t windows/consul:${VERSION}-local -f ./Dockerfile-consul-local-windows . --build-arg VERSION=${VERSION}

# Pull Windows Nanoserver image
echo " "
Expand Down

0 comments on commit 38e6133

Please sign in to comment.