Skip to content

Commit 36d9195

Browse files
Merge pull request #133 from StefanScherer/read-caddy-version-from-dockerfile
Read CADDY_VERSION from Dockerfile
2 parents e174bf9 + 26e6b98 commit 36d9195

4 files changed

Lines changed: 8 additions & 6 deletions

File tree

caddy/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# escape=`
22
FROM microsoft/nanoserver
3-
# note this version was a tagging mistake and the version is usually referred to as 0.10 - https://github.com/mholt/caddy/releases/tag/v0.10.0
43
ENV CADDY_VERSION 0.10.0
54
RUN powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; `
65
Invoke-WebRequest $('https://github.com/mholt/caddy/releases/download/v{0}/caddy_v{0}_windows_amd64.zip' -f $env:CADDY_VERSION) -OutFile 'caddy.zip' -UseBasicParsing ; `

caddy/build.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
docker build -t caddy:0.10 .
1+
$version=$(select-string -Path Dockerfile -Pattern "ENV CADDY_VERSION").ToString().split()[-1]
2+
docker build -t caddy:$version .

caddy/push.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
docker tag caddy:0.10 stefanscherer/caddy-windows:0.10
2-
docker tag caddy:0.10 stefanscherer/caddy-windows:latest
3-
docker push stefanscherer/caddy-windows:0.10
1+
$version=$(select-string -Path Dockerfile -Pattern "ENV CADDY_VERSION").ToString().split()[-1]
2+
docker tag caddy:$version stefanscherer/caddy-windows:$version
3+
docker tag caddy:$version stefanscherer/caddy-windows:latest
4+
docker push stefanscherer/caddy-windows:$version
45
docker push stefanscherer/caddy-windows:latest

caddy/test.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
docker run --name caddy -d -p 8080:80 -v "$(pwd)\conf:C:\caddy\conf" -v "$(pwd)\www:C:\wwwroot" caddy:0.10
1+
$version=$(select-string -Path Dockerfile -Pattern "ENV CADDY_VERSION").ToString().split()[-1]
2+
docker run --name caddy -d -p 8080:80 -v "$(pwd)\conf:C:\caddy\conf" -v "$(pwd)\www:C:\wwwroot" caddy:$version
23
Start-Sleep -Seconds 5
34
$req = Invoke-WebRequest http://$(docker inspect -f '{{ .NetworkSettings.Networks.nat.IPAddress }}' caddy) -UseBasicParsing
45
$code = $req.statuscode

0 commit comments

Comments
 (0)