Skip to content

Commit

Permalink
GitHub actions (#47)
Browse files Browse the repository at this point in the history
ci: switch to Guthub Actions
  • Loading branch information
fholzer authored Feb 22, 2022
1 parent fc86883 commit 2a6e0eb
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 2 deletions.
19 changes: 19 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
# Set default charset
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8

[*.{yaml,yml,sh}]
indent_style = space
indent_size = 2

[Dockerfile]
indent_style = tab
indent_size = 4
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: CI

on:
push:
branches-ignore:
- master
- mainline
tags-ignore:
- v*

env:
IMAGE_NAME: nginx-brotli

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]

- name: Build amd64 image
uses: docker/[email protected]
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
platforms: linux/amd64
push: false
tags: ${{ env.IMAGE_NAME }}
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Test
run: |
docker run --rm -v $(pwd)/tests.sh:/tests.sh --entrypoint sh nginx-brotli /tests.sh
76 changes: 76 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: Publish

on:
push:
branches:
- master
- mainline
tags:
- v*

env:
IMAGE_NAME: nginx-brotli

jobs:
build-test-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=raw,priority=1000,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
type=raw,priority=1000,value=mainline-latest,enable=${{ github.ref == 'refs/heads/mainline' }}
type=match,priority=600,pattern=^(v\d+\.\d+\.\d+)$,group=0
- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
id: buildx
uses: docker/[email protected]

- name: Build amd64 image
uses: docker/[email protected]
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
platforms: linux/amd64
push: false
tags: ${{ steps.meta.outputs.tags }}
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: List images
run: |
docker images
- name: Test
run: |
docker run --rm -v $(pwd)/tests.sh:/tests.sh --entrypoint sh nginx-brotli /tests.sh
- name: Login to Docker Hub
uses: docker/login-action@v1
if: github.event_name != 'pull_request'
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}


- name: Build amd64 image
uses: docker/[email protected]
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
platforms: linux/amd64,linux/arm64,linux/ppc64le
push: false
tags: ${{ env.IMAGE_NAME }}
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ COPY nginx.vh.default.conf /etc/nginx/conf.d/default.conf

EXPOSE 80 443

STOPSIGNAL SIGTERM
STOPSIGNAL SIGQUIT

CMD ["nginx", "-g", "daemon off;"]
ENTRYPOINT ["nginx"]
CMD ["-g", "daemon off;"]

0 comments on commit 2a6e0eb

Please sign in to comment.