Skip to content

Commit 29f9fb2

Browse files
authored
Merge pull request #2 from dlcs/feature/set_http_port
Set HTTP Port with Envvar
2 parents d159e8a + bec6d26 commit 29f9fb2

File tree

4 files changed

+27
-8
lines changed

4 files changed

+27
-8
lines changed

.github/workflows/build-deploy.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- master
7+
tags:
8+
- "*"
79
pull_request:
810
branches:
911
- master
@@ -19,23 +21,35 @@ jobs:
1921

2022
- name: Set up Docker Buildx
2123
id: buildx
22-
uses: docker/setup-buildx-action@v1
24+
uses: docker/setup-buildx-action@v2
2325

2426
- name: Login to GitHub Container Registry
25-
if: github.event_name != 'pull_request'
26-
uses: docker/login-action@v1
27+
uses: docker/login-action@v2
2728
with:
2829
registry: ghcr.io
2930
username: ${{ github.actor }}
3031
password: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Docker meta
34+
id: docker_meta
35+
uses: docker/metadata-action@v4
36+
with:
37+
images: ghcr.io/dlcs/dlcs-varnish
38+
tags: |
39+
type=ref,event=branch
40+
type=ref,event=pr
41+
type=semver,pattern={{version}}
42+
type=semver,pattern={{major}}.{{minor}}
43+
type=sha,enable=true,prefix=,format=long
3144
3245
- name: Build and push
3346
id: docker_build
34-
uses: docker/build-push-action@v2
47+
uses: docker/build-push-action@v4
3548
with:
3649
context: .
3750
builder: ${{ steps.buildx.outputs.name }}
38-
push: ${{ github.event_name != 'pull_request' }}
39-
tags: ghcr.io/dlcs/dlcs-varnish:${{ github.sha }}
51+
push: true
52+
labels: ${{ steps.docker_meta.outputs.labels }}
53+
tags: ${{ steps.docker_meta.outputs.tags }}
4054

4155

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM ubuntu:20.04
22

3+
LABEL maintainer="Donald Gray <donald.gray@digirati.com>"
4+
LABEL org.opencontainers.image.source=https://github.com/dlcs/dlcs-varnish
5+
LABEL org.opencontainers.image.description="Varnish on Ubuntu, vcl sourced from S3"
6+
37
RUN apt-get update -y && apt-get install -y varnish python3-pip
48
RUN pip install awscli
59

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The following environment files are expected:
1111
* `S3_VCL_FILE` - The location of a vcl file to use. Expected S3Uri as it is used by [aws s3 cp](https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html) command.
1212
* `VARNISH_CACHE_FOLDER` - Folder where disk backed cache is stored.
1313
* `VARNISH_CACHE_SIZE` - Size of cache.
14+
* `VARNISH_PORT` - Which port Varnish should listen on (defaults to 80)
1415

1516
## Running
1617

@@ -19,7 +20,7 @@ The following environment files are expected:
1920
docker build -t dlcs-varnish:local .
2021

2122
# run
22-
sudo docker run -t -i --rm \
23+
docker run -it --rm \
2324
--env AWS_ACCESS_KEY_ID='xxx' \
2425
--env AWS_SECRET_ACCESS_KEY='xxx' \
2526
--env S3_VCL_FILE='s3://my-bucket/varnish-config.vcl' \

start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ RELOAD_VCL=1
88

99
mkdir -p ${VARNISH_CACHE_FOLDER}
1010

11-
varnishd -a 0.0.0.0:80 -T 127.0.0.1:6082 -f /etc/varnish/default.vcl -s file,${VARNISH_CACHE_FOLDER}/varnish_cache.bin,${VARNISH_CACHE_SIZE}
11+
varnishd -a 0.0.0.0:${VARNISH_PORT} -T 127.0.0.1:6082 -f /etc/varnish/default.vcl -s file,${VARNISH_CACHE_FOLDER}/varnish_cache.bin,${VARNISH_CACHE_SIZE}
1212

1313
varnishlog

0 commit comments

Comments
 (0)