Skip to content
Snippets Groups Projects
Commit 19cc92c4 authored by ThanKarab's avatar ThanKarab
Browse files

Github actions for build/push in dockerhub.

parent ba8216be
No related branches found
No related tags found
1 merge request!40Dev/automated build and push actions
name: Publish images
on:
release:
types: [published]
jobs:
build_and_push:
name: Build image and push to dockerhub
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: hbpmip/portal-backend
- name: Load cached image
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache/portal-backend
key: buildx-backend
restore-keys: buildx-backend
- name: Build and Push image to dockerhub
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache/portal-backend
cache-to: type=local,dest=/tmp/.buildx-cache-new/portal-backend
# Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
- name: Move Docker images cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment