Skip to content
This repository has been archived by the owner on Apr 29, 2024. It is now read-only.

Merge remote-tracking branch 'upstream/master' #50

Merge remote-tracking branch 'upstream/master'

Merge remote-tracking branch 'upstream/master' #50

name: Create and publish Docker image
on:
push:
branches:
- "master"
tags:
- "*.**"
env:
REGISTRY: ghcr.io
GHCR_IMAGE_NAME: ${{ github.repository }}
DOCKERHUB_IMAGE_NAME: posthog-unlocked
DOCKERHUB_USERNAME: karambir
jobs:
build-and-push-image:
if: github.repository_owner == 'karambir'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ env.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the Github Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKERHUB_IMAGE_NAME }}
${{ env.REGISTRY }}/${{ env.GHCR_IMAGE_NAME }}
tags: |
type=sha
type=ref,event=tag
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') || github.ref_type == 'tag' }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: production.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}