Add GH action for nginx docker image
This commit is contained in:
parent
f0a5d2f167
commit
789d5d16f7
43
.github/workflows/docker-build.yml
vendored
43
.github/workflows/docker-build.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: Docker Multi-Architecture Build
|
nme: Docker Multi-Architecture Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -90,3 +90,44 @@ jobs:
|
|||||||
tags: ytorg/yotter:pypy
|
tags: ytorg/yotter:pypy
|
||||||
cache-from: type=local,src=cache
|
cache-from: type=local,src=cache
|
||||||
cache-to: type=local,dest=cache
|
cache-to: type=local,dest=cache
|
||||||
|
nginx-build-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
with:
|
||||||
|
platforms: all
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
- name: Get hash of latest image
|
||||||
|
run: docker pull nginx:mainline-alpine && docker inspect --format='{{index .RepoDigests 0}}' nginx:mainline-alpine > dockerhash.txt
|
||||||
|
- name: Write the current version to a file
|
||||||
|
run: "{ git describe --tags --abbrev=0 & date +\"%d-%m-%y\" & git rev-list HEAD --max-count=1 --abbrev-commit;} > version.txt"
|
||||||
|
- name: cache docker cache
|
||||||
|
uses: actions/cache@v2.1.4
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/cache
|
||||||
|
key: ${{ runner.os }}-docker-nginx-${{ hashFiles('**/dockerhash.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-docker-nginx-
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ytorg/nginx:latest
|
||||||
|
cache-from: type=local,src=cache
|
||||||
|
cache-to: type=local,dest=cache
|
||||||
|
@ -13,9 +13,7 @@ services:
|
|||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "mysqladmin", "ping", "--silent"]
|
test: ["CMD", "mysqladmin", "ping", "--silent"]
|
||||||
nginx:
|
nginx:
|
||||||
build:
|
image: ytorg/nginx:latest
|
||||||
context: .
|
|
||||||
dockerfile: nginx.Dockerfile
|
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
HOSTNAME: 'changeme.example.com'
|
HOSTNAME: 'changeme.example.com'
|
||||||
|
Reference in New Issue
Block a user