Skip to content

Commit

Permalink
Docker GCR job
Browse files Browse the repository at this point in the history
Pushes a prebuilt docker image to GCR
  • Loading branch information
FredrikAugust committed Mar 1, 2021
1 parent 0ca7c88 commit 5b09ec4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/gcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Docker Registry

on:
schedule:
# https://crontab.guru/#0_4_*_*_*
- cron: '0 4 * * *' # everyday at 04AM
workflow_dispatch:
push:
branches:
- '**'
tags:
- "v*.*.*"
pull_request:
branches:
- 'master'

jobs:
docker:
name: Build image and push to GCR
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker metainformation
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: |
ghcr.io/it2901-sintef01/frontend
tag-sha: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/[email protected]
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}
- name: Build and push production image
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ COPY nginx/nginx.conf /etc/nginx/conf.d
# Doesn't really do anything, but serves as a hint you should forward the port to the host computer
EXPOSE 80

LABEL org.opencontainers.image.source=https://github.com/it2901-sintef01/frontend

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

0 comments on commit 5b09ec4

Please sign in to comment.