mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
feat(ci): Use Depot for Docker builds in CI (#10624)
* Revert "Revert "feat(ci): use Depot for Docker builds in CI (#10002)" (#10179)"
This reverts commit efb1eb21f2.
* Set posthog-cloud project
Co-authored-by: Jacob Gillespie <jacobwgillespie@gmail.com>
This commit is contained in:
19
.github/workflows/build-and-deploy-prod.yml
vendored
19
.github/workflows/build-and-deploy-prod.yml
vendored
@@ -16,7 +16,12 @@ jobs:
|
|||||||
name: Build & Deploy Production Docker image
|
name: Build & Deploy Production Docker image
|
||||||
if: github.repository == 'PostHog/posthog'
|
if: github.repository == 'PostHog/posthog'
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
|
- name: Set up Depot CLI
|
||||||
|
uses: depot/setup-action@v1
|
||||||
- name: Configure AWS credentials
|
- name: Configure AWS credentials
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
with:
|
with:
|
||||||
@@ -41,14 +46,24 @@ jobs:
|
|||||||
# ref: 'master'
|
# ref: 'master'
|
||||||
path: 'deploy/'
|
path: 'deploy/'
|
||||||
|
|
||||||
- name: Build, tag, and push image to Amazon ECR
|
- name: Build image
|
||||||
|
uses: depot/build-push-action@v1
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: prod.web.Dockerfile
|
||||||
|
load: true
|
||||||
|
tags: |
|
||||||
|
${{ steps.login-ecr.outputs.registry }}/posthog-production:${{ github.sha }}
|
||||||
|
${{ steps.login-ecr.outputs.registry }}/posthog-production:latest
|
||||||
|
project: 1stsk4xt19 # posthog-cloud project
|
||||||
|
|
||||||
|
- name: Push image to Amazon ECR
|
||||||
id: build-image
|
id: build-image
|
||||||
env:
|
env:
|
||||||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
|
||||||
ECR_REPOSITORY: posthog-production
|
ECR_REPOSITORY: posthog-production
|
||||||
IMAGE_TAG: ${{ github.sha }}
|
IMAGE_TAG: ${{ github.sha }}
|
||||||
run: |
|
run: |
|
||||||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest -f prod.web.Dockerfile .
|
|
||||||
docker push --all-tags $ECR_REGISTRY/$ECR_REPOSITORY
|
docker push --all-tags $ECR_REGISTRY/$ECR_REPOSITORY
|
||||||
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
|
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
|
||||||
|
|
||||||
|
|||||||
17
.github/workflows/docker-image-publish.yml
vendored
17
.github/workflows/docker-image-publish.yml
vendored
@@ -13,6 +13,9 @@ jobs:
|
|||||||
name: Build Docker images and push them
|
name: Build Docker images and push them
|
||||||
if: github.repository == 'PostHog/posthog'
|
if: github.repository == 'PostHog/posthog'
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout default branch
|
- name: Checkout default branch
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -20,16 +23,10 @@ jobs:
|
|||||||
- name: Update git sha
|
- name: Update git sha
|
||||||
run: echo "GIT_SHA = '${GITHUB_SHA}'" >posthog/gitsha.py
|
run: echo "GIT_SHA = '${GITHUB_SHA}'" >posthog/gitsha.py
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up Depot CLI
|
||||||
if: github.repository == 'PostHog/posthog'
|
uses: depot/setup-action@v1
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
if: github.repository == 'PostHog/posthog'
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: github.repository == 'PostHog/posthog'
|
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
@@ -37,15 +34,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and push latest
|
- name: Build and push latest
|
||||||
id: docker-latest
|
id: docker-latest
|
||||||
if: github.repository == 'PostHog/posthog'
|
uses: depot/build-push-action@v1
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: posthog/posthog:latest
|
tags: posthog/posthog:latest
|
||||||
|
|
||||||
- name: Image digests
|
- name: Image digests
|
||||||
if: github.repository == 'PostHog/posthog'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Pushed latest: ${{ steps.docker-latest.outputs.digest }}"
|
echo "Pushed latest: ${{ steps.docker-latest.outputs.digest }}"
|
||||||
echo "Pushed dev: ${{ steps.docker-dev.outputs.digest }}"
|
echo "Pushed dev: ${{ steps.docker-dev.outputs.digest }}"
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build-push:
|
build-push:
|
||||||
name: Build & push Docker release image
|
name: Build & push Docker release image
|
||||||
|
if: github.repository == 'PostHog/posthog'
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout default branch
|
- name: Checkout default branch
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -21,16 +25,10 @@ jobs:
|
|||||||
- name: Update git SHA
|
- name: Update git SHA
|
||||||
run: echo "GIT_SHA = '${GITHUB_SHA}'" > posthog/gitsha.py
|
run: echo "GIT_SHA = '${GITHUB_SHA}'" > posthog/gitsha.py
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up Depot CLI
|
||||||
if: github.repository == 'PostHog/posthog'
|
uses: depot/setup-action@v1
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
if: github.repository == 'PostHog/posthog'
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: github.repository == 'PostHog/posthog'
|
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
@@ -38,8 +36,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and push release
|
- name: Build and push release
|
||||||
id: docker-release
|
id: docker-release
|
||||||
if: github.repository == 'PostHog/posthog'
|
uses: depot/build-push-action@v1
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
@@ -48,6 +45,5 @@ jobs:
|
|||||||
posthog/posthog:release-${{ env.TAG_NAME }}
|
posthog/posthog:release-${{ env.TAG_NAME }}
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
if: github.repository == 'PostHog/posthog'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Pushed release: ${{ steps.docker-release.outputs.digest }}"
|
echo "Pushed release: ${{ steps.docker-release.outputs.digest }}"
|
||||||
|
|||||||
17
.github/workflows/docker-unstable-image.yml
vendored
17
.github/workflows/docker-unstable-image.yml
vendored
@@ -12,6 +12,9 @@ jobs:
|
|||||||
name: Build & push Docker release image
|
name: Build & push Docker release image
|
||||||
if: github.repository == 'PostHog/posthog'
|
if: github.repository == 'PostHog/posthog'
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout default branch
|
- name: Checkout default branch
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -22,16 +25,10 @@ jobs:
|
|||||||
- name: Update git SHA
|
- name: Update git SHA
|
||||||
run: echo "GIT_SHA = '${GITHUB_SHA}'" > posthog/gitsha.py
|
run: echo "GIT_SHA = '${GITHUB_SHA}'" > posthog/gitsha.py
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up Depot CLI
|
||||||
if: github.repository == 'PostHog/posthog'
|
uses: depot/setup-depot@v1
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
if: github.repository == 'PostHog/posthog'
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: github.repository == 'PostHog/posthog'
|
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
@@ -39,14 +36,12 @@ jobs:
|
|||||||
|
|
||||||
- name: Build and push release
|
- name: Build and push release
|
||||||
id: docker-release
|
id: docker-release
|
||||||
if: github.repository == 'PostHog/posthog'
|
uses: depot/build-push-action@v1
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: posthog/posthog:${{ env.BRANCH_NAME }}-unstable
|
tags: posthog/posthog:${{ env.BRANCH_NAME }}-unstable
|
||||||
|
|
||||||
- name: Image digest
|
- name: Image digest
|
||||||
if: github.repository == 'PostHog/posthog'
|
|
||||||
run: |
|
run: |
|
||||||
echo "Pushed release: ${{ steps.docker-release.outputs.digest }}"
|
echo "Pushed release: ${{ steps.docker-release.outputs.digest }}"
|
||||||
|
|||||||
13
.github/workflows/foss-release-image-publish.yml
vendored
13
.github/workflows/foss-release-image-publish.yml
vendored
@@ -12,6 +12,9 @@ jobs:
|
|||||||
build-push:
|
build-push:
|
||||||
name: Build & push Docker release image
|
name: Build & push Docker release image
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout default branch
|
- name: Checkout default branch
|
||||||
if: github.repository == 'PostHog/posthog-foss'
|
if: github.repository == 'PostHog/posthog-foss'
|
||||||
@@ -25,13 +28,9 @@ jobs:
|
|||||||
if: github.repository == 'PostHog/posthog-foss'
|
if: github.repository == 'PostHog/posthog-foss'
|
||||||
run: echo "GIT_SHA = '${GITHUB_SHA}'" > posthog/gitsha.py
|
run: echo "GIT_SHA = '${GITHUB_SHA}'" > posthog/gitsha.py
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up Depot CLI
|
||||||
if: github.repository == 'PostHog/posthog-foss'
|
if: github.repository == 'PostHog/posthog-foss'
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: depot/setup-action@v1
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
if: github.repository == 'PostHog/posthog-foss'
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to DockerHub
|
||||||
if: github.repository == 'PostHog/posthog-foss'
|
if: github.repository == 'PostHog/posthog-foss'
|
||||||
@@ -43,7 +42,7 @@ jobs:
|
|||||||
- name: Build and push release
|
- name: Build and push release
|
||||||
if: github.repository == 'PostHog/posthog-foss'
|
if: github.repository == 'PostHog/posthog-foss'
|
||||||
id: docker-release
|
id: docker-release
|
||||||
uses: docker/build-push-action@v2
|
uses: depot/build-push-action@v1
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
|
|||||||
1
depot.json
Normal file
1
depot.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{ "id": "x19jffd9zf" }
|
||||||
Reference in New Issue
Block a user