Skip to content
name: Publish production Docker image
concurrency:
group: prod_deploy
cancel-in-progress: true
on:
pull_request:
branches:
- main
types:
- closed
workflow_dispatch:
inputs:
git-ref:
description: Git Ref (Optional)
required: false
env:
REGISTRY: ghcr.io
IMAGE_NAME: lubimovka_frontend
jobs:
push_to_registry:
name: Build and push Docker image
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
packages: write
steps:
- name: Check out the repo
uses: actions/checkout@v3
# if: github.event.inputs.git-ref != ''
# with:
# ref: ${{ github.event.inputs.git-ref }}
- name: Log in to Github Packages Registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set environment variables
run: |
echo REPOSITORY_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Build and publish to Github Packages Registry
uses: docker/build-push-action@v3
with:
context: .
file: config/docker/Dockerfile
labels: runnumber=${GITHUB_RUN_ID}
push: true
build-args: |
BASE_URL=${{ secrets.BASE_URL }}
API_BASE_URL=${{ secrets.API_BASE_URL }}
GA_TRACKING_ID=${{ secrets.GA_TRACKING_ID }}
tags: |
${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}:production
${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.sha }}