Skip to content

Build container image #1

Build container image

Build container image #1

name: Build container image
on:
push:
tags:
jobs:
push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build . --file Dockerfile --tag webapp
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/gleam/packages
IMAGE_ID="$IMAGE_ID":$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
docker tag webapp $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION