Skip to content
Merged
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
27 changes: 24 additions & 3 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,44 @@ on:
jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Build the Docker image
env:
CACHE_IMAGE: macbre/nginx-brotli:latest

# @see https://docs.docker.com/develop/develop-images/build_enhancements/
COMPOSE_DOCKER_CLI_BUILD: "1"
DOCKER_BUILDKIT: "1"

run: |
docker build . --tag ${{ github.repository }}
# build an image using the current Docker Hub container image as a layers cache

# @see https://docs.docker.com/engine/reference/commandline/build/#specifying-external-cache-sources
# no need to "docker pull $CACHE_IMAGE", BuildKit is clever enough to pull it when needed
docker build . \
--tag ${{ github.repository }} \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from $CACHE_IMAGE
docker images

- name: Run nginx -V
run: docker run -t ${{ github.repository }} nginx -V

- name: Serve a static asset
run: |
docker run --detach --rm -p 0.0.0.0:8888:80 -v "$PWD/tests":/static:ro -v "$PWD/tests/static.conf":/etc/nginx/conf.d/static.conf:ro -v "$PWD/tests/env.conf":/etc/nginx/main.d/env.conf:ro --env FOO=foo-test-value --name test_nginx -t ${{ github.repository }}
docker run --detach --rm \
-p 0.0.0.0:8888:80 \
-v "$PWD/tests":/static:ro \
-v "$PWD/tests/static.conf":/etc/nginx/conf.d/static.conf:ro \
-v "$PWD/tests/env.conf":/etc/nginx/main.d/env.conf:ro \
--env FOO=foo-test-value \
--name test_nginx \
-t ${{ github.repository }}

sleep 2; docker ps
curl -v --compressed 0.0.0.0:8888 2>&1 | tee /tmp/out

Expand Down