feat(Dockerfile): update base images and streamline package installation #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build image | |
on: | |
push: | |
branches: | |
- develop | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: set up golang | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.17 | |
- name: check out code | |
uses: actions/checkout@v2 | |
- name: set up docker buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: cache docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: login to dockerhub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: get short sha | |
id: type | |
run: | | |
sha=$(git rev-parse --short HEAD) | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
echo ::set-output name=id::${sha} | |
echo ::set-output name=branch::${branch} | |
- name: build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
tags: dictybase/static-server:${{ steps.type.outputs.branch }}-${{ steps.type.outputs.id }} | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache |