2021-07-12 23:14:39 +03:00
|
|
|
# syntax = docker/dockerfile:1.2
|
|
|
|
|
2024-09-06 01:40:44 +03:00
|
|
|
FROM rust:1.81-bookworm as builder
|
2021-07-12 23:14:39 +03:00
|
|
|
WORKDIR app
|
|
|
|
COPY . .
|
|
|
|
|
2024-09-16 21:17:15 +03:00
|
|
|
# Replace the Cargo configuration with the one used by collab.
|
|
|
|
COPY ./.cargo/collab-config.toml ./.cargo/config.toml
|
|
|
|
|
2022-04-09 17:30:42 +03:00
|
|
|
# Compile collab server
|
2023-01-27 11:50:59 +03:00
|
|
|
ARG CARGO_PROFILE_RELEASE_PANIC=abort
|
2024-02-01 21:54:49 +03:00
|
|
|
ARG GITHUB_SHA
|
|
|
|
|
|
|
|
ENV GITHUB_SHA=$GITHUB_SHA
|
2024-09-16 19:40:56 +03:00
|
|
|
|
2024-10-07 23:25:17 +03:00
|
|
|
# Also add `cmake`, since we need it to build `wasmtime`.
|
2024-09-16 19:40:56 +03:00
|
|
|
RUN apt-get update; \
|
2024-10-11 20:28:34 +03:00
|
|
|
apt-get install -y --no-install-recommends cmake
|
2024-09-16 19:40:56 +03:00
|
|
|
|
2021-07-12 23:14:39 +03:00
|
|
|
RUN --mount=type=cache,target=./script/node_modules \
|
|
|
|
--mount=type=cache,target=/usr/local/cargo/registry \
|
2024-02-15 01:11:57 +03:00
|
|
|
--mount=type=cache,target=/usr/local/cargo/git \
|
2021-07-12 23:14:39 +03:00
|
|
|
--mount=type=cache,target=./target \
|
2022-04-09 17:30:42 +03:00
|
|
|
cargo build --release --package collab --bin collab
|
2021-07-12 23:14:39 +03:00
|
|
|
|
2022-04-09 17:30:42 +03:00
|
|
|
# Copy collab server binary out of cached directory
|
2021-07-12 23:14:39 +03:00
|
|
|
RUN --mount=type=cache,target=./target \
|
2022-04-09 17:30:42 +03:00
|
|
|
cp /app/target/release/collab /app/collab
|
2021-07-12 23:14:39 +03:00
|
|
|
|
2022-04-09 17:30:42 +03:00
|
|
|
# Copy collab server binary to the runtime image
|
2024-03-06 20:27:08 +03:00
|
|
|
FROM debian:bookworm-slim as runtime
|
2021-07-12 23:14:39 +03:00
|
|
|
RUN apt-get update; \
|
2024-03-07 02:39:48 +03:00
|
|
|
apt-get install -y --no-install-recommends libcurl4-openssl-dev ca-certificates \
|
|
|
|
linux-perf binutils
|
2021-07-12 23:14:39 +03:00
|
|
|
WORKDIR app
|
2022-10-21 23:15:34 +03:00
|
|
|
COPY --from=builder /app/collab /app/collab
|
|
|
|
COPY --from=builder /app/crates/collab/migrations /app/migrations
|
2024-08-07 00:18:08 +03:00
|
|
|
COPY --from=builder /app/crates/collab/migrations_llm /app/migrations_llm
|
2022-10-21 23:15:34 +03:00
|
|
|
ENV MIGRATIONS_PATH=/app/migrations
|
2024-08-07 00:18:08 +03:00
|
|
|
ENV LLM_DATABASE_MIGRATIONS_PATH=/app/migrations_llm
|
2022-04-09 17:30:42 +03:00
|
|
|
ENTRYPOINT ["/app/collab"]
|