Skip to content

dockerfile: Use distroless image. Run as non-root user. #29

dockerfile: Use distroless image. Run as non-root user.

dockerfile: Use distroless image. Run as non-root user. #29

Workflow file for this run

name: Create and publish a api image
on:
push:
tags:
- v**
env:
REGISTRY: ghcr.io/metal-toolbox
API_IMAGE_NAME: audito-maldito/audito-maldito
jobs:
auto-release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get current date
id: date
run: echo "::set-output name=date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
- name: Extract metadata (tags, labels) for Docker
id: meta-api
uses: docker/metadata-action@ef25336f420be2d1a49205baf41a9b88712a65a1
with:
images: ${{ env.REGISTRY }}/${{ env.API_IMAGE_NAME }}
- name: Build rsyslog and push Docker image
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
with:
context: "./contrib/rsyslog"
push: true
file: ./contrib/rsyslog/Dockerfile.ubuntu
tags: ${{ env.REGISTRY }}/${{ env.API_IMAGE_NAME }}:${{ github.ref_name }}-rsyslog
labels: ${{ steps.meta-api.outputs.labels }}
- name: Build and push Docker image
uses: docker/build-push-action@2eb1c1961a95fc15694676618e422e8ba1d63825
with:
push: true
file: Dockerfile
tags: ${{ env.REGISTRY }}/${{ env.API_IMAGE_NAME }}:${{ github.ref_name }}
labels: ${{ steps.meta-api.outputs.labels }}