diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 61679af..9861f38 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,9 @@ stages: - deploy variables: SECRET_DETECTION_ENABLED: "true" + # Use our own fork of Tranquil PDS repo to avoid issues with Tangled's knotserver being unavailable + TRANQUIL_PDS_REPO: "https://gitlab.com/recaptime-dev/patches/tranquil-pds" + TRANQUIL_PDS_BRANCH: "recaptime-dev/main" secret_detection: stage: secret-detection build-binary: @@ -36,10 +39,36 @@ build-binary: --frontend=dockerfile.v0 \ --local context="$CI_PROJECT_DIR/build" \ --local dockerfile="$CI_PROJECT_DIR/build" \ + --opt build-arg:TRANQUIL_PDS_REPO="$TRANQUIL_PDS_REPO" \ + --opt build-arg:TRANQUIL_PDS_BRANCH="$TRANQUIL_PDS_BRANCH" \ --opt platform=linux/amd64,linux/arm64 \ --export-cache type=registry,ref=$CACHE_IMAGE \ --import-cache type=registry,ref=$CACHE_IMAGE \ --output type=image,name=$CI_REGISTRY_IMAGE/deploy-artifacts:commit-$CI_COMMIT_SHA,push=true \ --output type=image,name=$CI_REGISTRY_IMAGE/deploy-artifacts:latest,push=true +extract-binary-from-image: + stage: build + needs: + - build-binary + services: + - docker:dind + script: + - | + docker pull --platform=linux/amd64 $CI_REGISTRY_IMAGE/deploy-artifacts:commit-$CI_COMMIT_SHA + docker pull --platform=linux/arm64 $CI_REGISTRY_IMAGE/deploy-artifacts:commit-$CI_COMMIT_SHA + - | + docker create --name amd64-builds --platform=linux/amd64 $CI_REGISTRY_IMAGE/deploy-artifacts:commit-$CI_COMMIT_SHA + docker create --name arm64-builds --platform=linux/arm64 $CI_REGISTRY_IMAGE/deploy-artifacts:commit-$CI_COMMIT_SHA + - | + docker cp amd64-builds:/app/dist ./dist/amd64 + docker cp arm64-builds:/app/dist ./dist/arm64 + - docker rm amd64-builds && docker rm arm64-builds + artifacts: + untracked: false + when: on_success + access: all + expire_in: 30 days + paths: + - dist/ include: - template: Security/Secret-Detection.gitlab-ci.yml diff --git a/build/Dockerfile b/build/Dockerfile index 3986cc9..346dc04 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -3,13 +3,14 @@ FROM alpine:edge AS starting-point ARG TRANQUIL_PDS_REPO=https://tangled.org/tranquil.farm/tranquil-pds ARG TRANQUIL_PDS_BRANCH=main +WORKDIR / RUN apk add --no-cache git \ && git clone --depth 1 --branch $TRANQUIL_PDS_BRANCH $TRANQUIL_PDS_REPO /src FROM node:26-slim AS frontend RUN corepack enable && corepack prepare pnpm@latest --activate WORKDIR /app -COPY --from=starting-point frontend/ ./ +COPY --from=starting-point /src/frontend/ ./ RUN pnpm install --frozen-lockfile && pnpm build FROM rust:1.96-slim-trixie AS builder @@ -37,7 +38,7 @@ RUN mkdir -p /stage/var/lib/tranquil-pds/blobs /stage/var/lib/tranquil-pds/store ENV RUSTFLAGS="-C linker=clang -C link-arg=-fuse-ld=mold" WORKDIR /app ARG SLIM="false" -COPY --from=starting-point Cargo.toml Cargo.lock .sqlx crates migrations ./ +COPY --from=starting-point /src/Cargo.toml /src/Cargo.lock /src/.sqlx /src/crates /src/migrations ./ RUN --mount=type=cache,id=cargo-registry,target=/usr/local/cargo/registry \ --mount=type=cache,id=cargo-git,target=/usr/local/cargo/git \ --mount=type=cache,id=tranquil-target,target=/app/target,sharing=locked \