fix: Dockerfile to reduce vulnerabilities (#56) #39
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: Docker CI | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Builds the Docker image | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build the image | |
run: docker build -t docker.pkg.github.com/microup/vbalancer/vbalancer:latest . | |
- name: Save the image | |
run: docker save -o image.tar docker.pkg.github.com/microup/vbalancer/vbalancer:latest | |
- name: Upload image to artifacts | |
uses: actions/upload-artifact@v1 | |
with: | |
name: image | |
path: image.tar | |
publish: | |
name: Publish the Docker image | |
needs: build | |
runs-on: [ubuntu-latest] | |
steps: | |
- name: Download the image from artifacts | |
uses: actions/download-artifact@v1 | |
with: | |
name: image | |
- name: Load the image | |
run: docker load -i image/image.tar | |
- name: Login to docker.pkg.github.com | |
run: echo ${{ secrets.TOKEN }} | docker login docker.pkg.github.com --username ${{ secrets.USERNAME }} --password-stdin | |
- name: Publish the image | |
run: docker push docker.pkg.github.com/microup/vbalancer/vbalancer:latest |