0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 04:12:23 +01:00
posthog/.github/actions/build-n-cache-image/action.yml
Frank Hamand c0b5061520
feat: Use single entrypoint for both images but detect which to run (#18883)
Make docker-server binary fixed between unit/gunicorn images

We want it to be a full drop-in replacement
2023-11-27 10:06:22 +00:00

58 lines
2.0 KiB
YAML

name: Build and cache Docker image
inputs:
actions-id-token-request-url:
required: true
description: "ACTIONS_ID_TOKEN_REQUEST_URL, issued by GitHub when permission 'id-token' is set to 'write'"
save:
required: false
default: 'false'
description: Whether to save the image in the Depot ephemeral registry after building it
outputs:
tag:
description: The tag of the image that was built
value: ${{ steps.emit.outputs.tag }}
build-id:
description: The ID of the build
value: ${{ steps.build.outputs.build-id }}
unit-build-id:
description: The ID of the unit build
value: ${{ steps.build-unit.outputs.build-id }}
runs:
using: 'composite'
steps:
- name: Set up Depot CLI
uses: depot/setup-action@v1
- name: Emit image tag
id: emit
shell: bash
run: echo "tag=posthog/posthog:${{ github.sha }}" >> $GITHUB_OUTPUT
- name: Build image # We don't push this because we use Depot cache as the communication channel
id: build
uses: depot/build-push-action@v1
with:
buildx-fallback: false # buildx is so slow it's better to just fail
tags: ${{ steps.emit.outputs.tag }}
platforms: linux/amd64,linux/arm64
build-args: COMMIT_HASH=${{ github.sha }}
save: ${{ inputs.save }}
env:
ACTIONS_ID_TOKEN_REQUEST_URL: ${{ inputs.actions-id-token-request-url }}
- name: Build unit image
id: build-unit
uses: depot/build-push-action@v1
with:
buildx-fallback: false # buildx is so slow it's better to just fail
file: production-unit.Dockerfile
tags: posthog/posthog:unit-${{ github.sha }}
platforms: linux/amd64,linux/arm64
build-args: COMMIT_HASH=${{ github.sha }}
save: ${{ inputs.save }}
env:
ACTIONS_ID_TOKEN_REQUEST_URL: ${{ inputs.actions-id-token-request-url }}