0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 00:46:45 +01:00
posthog/.github/actions/build-n-cache-image/action.yml
Frank Hamand 27ea8a7354
fix: Respect .dockerignore in depot builds (#19906)
Respect .dockerignore in depot builds

See https://github.com/docker/build-push-action#git-context

Without including "context: ." .dockerignore is not processed
2024-01-22 16:59:21 +00:00

46 lines
1.5 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 }}
runs:
using: 'composite'
steps:
- name: Checkout
uses: actions/checkout@v4
- 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:
context: .
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 }}