-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cyclotron): publish docker images (#24537)
- Loading branch information
1 parent
e6ad4a9
commit 4a0dbb1
Showing
7 changed files
with
103 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Build rust cyclotron-migrator docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths: | ||
- 'rust/**' | ||
- '.github/workflows/rust-cyclotron-migrator-docker.yml' | ||
branches: | ||
- 'master' | ||
|
||
permissions: | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
name: build and publish cyclotron-migrator image | ||
runs-on: depot-ubuntu-22.04-4 | ||
permissions: | ||
id-token: write # allow issuing OIDC tokens for this workflow run | ||
contents: read # allow reading the repo contents | ||
packages: write # allow push to ghcr.io | ||
|
||
defaults: | ||
run: | ||
working-directory: rust | ||
|
||
steps: | ||
- name: Check Out Repo | ||
# Checkout project code | ||
# Use sparse checkout to only select files in rust directory | ||
# Turning off cone mode ensures that files in the project root are not included during checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
sparse-checkout: 'rust/' | ||
sparse-checkout-cone-mode: false | ||
|
||
- name: Set up Depot CLI | ||
uses: depot/setup-action@v1 | ||
|
||
- name: Login to ghcr.io | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/posthog/posthog/cyclotron-migrator | ||
tags: | | ||
type=ref,event=pr | ||
type=ref,event=branch | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=sha | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build and push migrator | ||
id: docker_build_cyclotron_migrator | ||
uses: depot/build-push-action@v1 | ||
with: | ||
context: ./rust/ | ||
file: ./rust/Dockerfile.migrate-cyclotron | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/arm64 | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Cyclotron-migrator image digest | ||
run: echo ${{ steps.docker_build_cyclotron_migrator.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM docker.io/library/rust:1.80.1-bullseye as builder | ||
|
||
RUN apt update && apt install build-essential cmake -y | ||
RUN cargo install [email protected] --no-default-features --features native-tls,postgres --root /app/target/release/ | ||
|
||
FROM debian:bullseye-20230320-slim AS runtime | ||
WORKDIR /sqlx | ||
|
||
COPY bin /sqlx/bin/ | ||
COPY cyclotron-core/migrations /sqlx/migrations/ | ||
|
||
COPY --from=builder /app/target/release/bin/sqlx /usr/local/bin | ||
|
||
RUN chmod +x ./bin/migrate | ||
|
||
CMD ["./bin/migrate"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM docker.io/library/rust:1.74.0-buster as builder | ||
FROM docker.io/library/rust:1.80.1-bullseye as builder | ||
|
||
RUN apt update && apt install build-essential cmake -y | ||
RUN cargo install [email protected] --no-default-features --features native-tls,postgres --root /app/target/release/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters