diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index a6e6c35ee50fe..0000000000000 --- a/.dockerignore +++ /dev/null @@ -1,9 +0,0 @@ -**/target -zed.xcworkspace -.DS_Store -plugins/bin -script/node_modules -styles/node_modules -crates/collab/static/styles.css -vendor/bin -assets/themes/ diff --git a/.github/workflows/deploy_collab.yml b/.github/workflows/deploy_collab.yml index 953e4f1190f11..4bfcc3acf4e8c 100644 --- a/.github/workflows/deploy_collab.yml +++ b/.github/workflows/deploy_collab.yml @@ -5,6 +5,8 @@ on: tags: - collab-production - collab-staging + branches: + - collab-deploys env: DOCKER_BUILDKIT: 1 @@ -54,26 +56,26 @@ jobs: - style - tests runs-on: - - self-hosted - - deploy + - ubuntu-latest steps: - - name: Add Rust to the PATH - run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH - - - name: Sign into DigitalOcean docker registry - run: doctl registry login - - - name: Prune Docker system - run: docker system prune --filter 'until=720h' -f - - name: Checkout repo uses: actions/checkout@v4 with: clean: false submodules: "recursive" + fetch-depth: 0 + + - name: build collab + shell: bash -euxo pipefail {0} + run: | + export CARGO_PROFILE_RELEASE_PANIC=abort + cargo build --release --package collab --bin collab - name: Build docker image - run: docker build . --build-arg GITHUB_SHA=$GITHUB_SHA --tag registry.digitalocean.com/zed/collab:$GITHUB_SHA + run: docker build . --tag registry.digitalocean.com/zed/collab:$GITHUB_SHA + + - name: Sign into DigitalOcean docker registry + run: doctl registry login - name: Publish docker image run: docker push registry.digitalocean.com/zed/collab:${GITHUB_SHA} @@ -83,8 +85,7 @@ jobs: needs: - publish runs-on: - - self-hosted - - deploy + - ubuntu-latest steps: - name: Sign into Kubernetes diff --git a/Dockerfile b/Dockerfile index 55ab7fe67b9e9..df4c5c350c787 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,29 +1,12 @@ # syntax = docker/dockerfile:1.2 FROM rust:1.76-bullseye as builder -WORKDIR app -COPY . . - -# Compile collab server -ARG CARGO_PROFILE_RELEASE_PANIC=abort -ARG GITHUB_SHA - -ENV GITHUB_SHA=$GITHUB_SHA -RUN --mount=type=cache,target=./script/node_modules \ - --mount=type=cache,target=/usr/local/cargo/registry \ - --mount=type=cache,target=./target \ - cargo build --release --package collab --bin collab - -# Copy collab server binary out of cached directory -RUN --mount=type=cache,target=./target \ - cp /app/target/release/collab /app/collab - -# Copy collab server binary to the runtime image FROM debian:bullseye-slim as runtime RUN apt-get update; \ apt-get install -y --no-install-recommends libcurl4-openssl-dev ca-certificates +COPY ./target/release/collab /app/collab +COPY ./crates/collab/migrations /app/migrations + WORKDIR app -COPY --from=builder /app/collab /app/collab -COPY --from=builder /app/crates/collab/migrations /app/migrations ENV MIGRATIONS_PATH=/app/migrations ENTRYPOINT ["/app/collab"]