2021-07-12 20:14:39 +00:00
|
|
|
# syntax = docker/dockerfile:1.2
|
|
|
|
|
2024-09-05 22:40:44 +00:00
|
|
|
FROM rust:1.81-bookworm as builder
|
2021-07-12 20:14:39 +00:00
|
|
|
WORKDIR app
|
|
|
|
COPY . .
|
|
|
|
|
2024-09-16 18:17:15 +00:00
|
|
|
# Replace the Cargo configuration with the one used by collab.
|
|
|
|
COPY ./.cargo/collab-config.toml ./.cargo/config.toml
|
|
|
|
|
2022-04-09 14:30:42 +00:00
|
|
|
# Compile collab server
|
2023-01-27 08:50:59 +00:00
|
|
|
ARG CARGO_PROFILE_RELEASE_PANIC=abort
|
2024-02-01 18:54:49 +00:00
|
|
|
ARG GITHUB_SHA
|
|
|
|
|
|
|
|
ENV GITHUB_SHA=$GITHUB_SHA
|
2024-09-16 16:40:56 +00:00
|
|
|
|
|
|
|
# At some point in the past 3 weeks, additional dependencies on `xkbcommon` and
|
|
|
|
# `xkbcommon-x11` were introduced into collab.
|
|
|
|
#
|
2024-09-16 17:41:31 +00:00
|
|
|
# A `git bisect` points to this commit as being the culprit: `b8e6098f60e5dabe98fe8281f993858dacc04a55`.
|
|
|
|
#
|
2024-09-16 16:40:56 +00:00
|
|
|
# Now when we try to build collab for the Docker image, it fails with the following
|
|
|
|
# error:
|
|
|
|
#
|
|
|
|
# ```
|
|
|
|
# 985.3 = note: /usr/bin/ld: cannot find -lxkbcommon: No such file or directory
|
|
|
|
# 985.3 /usr/bin/ld: cannot find -lxkbcommon-x11: No such file or directory
|
|
|
|
# 985.3 collect2: error: ld returned 1 exit status
|
|
|
|
# ```
|
|
|
|
#
|
|
|
|
# The last successful deploys were at:
|
|
|
|
# - Staging: `4f408ec65a3867278322a189b4eb20f1ab51f508`
|
|
|
|
# - Production: `fc4c533d0a8c489e5636a4249d2b52a80039fbd7`
|
|
|
|
#
|
|
|
|
# Installing these as a temporary workaround, but I think ideally we'd want to figure
|
|
|
|
# out what caused them to be included in the first place.
|
|
|
|
RUN apt-get update; \
|
|
|
|
apt-get install -y --no-install-recommends libxkbcommon-dev libxkbcommon-x11-dev
|
|
|
|
|
2021-07-12 20:14:39 +00:00
|
|
|
RUN --mount=type=cache,target=./script/node_modules \
|
|
|
|
--mount=type=cache,target=/usr/local/cargo/registry \
|
2024-02-14 22:11:57 +00:00
|
|
|
--mount=type=cache,target=/usr/local/cargo/git \
|
2021-07-12 20:14:39 +00:00
|
|
|
--mount=type=cache,target=./target \
|
2022-04-09 14:30:42 +00:00
|
|
|
cargo build --release --package collab --bin collab
|
2021-07-12 20:14:39 +00:00
|
|
|
|
2022-04-09 14:30:42 +00:00
|
|
|
# Copy collab server binary out of cached directory
|
2021-07-12 20:14:39 +00:00
|
|
|
RUN --mount=type=cache,target=./target \
|
2022-04-09 14:30:42 +00:00
|
|
|
cp /app/target/release/collab /app/collab
|
2021-07-12 20:14:39 +00:00
|
|
|
|
2022-04-09 14:30:42 +00:00
|
|
|
# Copy collab server binary to the runtime image
|
2024-03-06 17:27:08 +00:00
|
|
|
FROM debian:bookworm-slim as runtime
|
2021-07-12 20:14:39 +00:00
|
|
|
RUN apt-get update; \
|
2024-03-06 23:39:48 +00:00
|
|
|
apt-get install -y --no-install-recommends libcurl4-openssl-dev ca-certificates \
|
|
|
|
linux-perf binutils
|
2021-07-12 20:14:39 +00:00
|
|
|
WORKDIR app
|
2022-10-21 20:15:34 +00:00
|
|
|
COPY --from=builder /app/collab /app/collab
|
|
|
|
COPY --from=builder /app/crates/collab/migrations /app/migrations
|
2024-08-06 21:18:08 +00:00
|
|
|
COPY --from=builder /app/crates/collab/migrations_llm /app/migrations_llm
|
2022-10-21 20:15:34 +00:00
|
|
|
ENV MIGRATIONS_PATH=/app/migrations
|
2024-08-06 21:18:08 +00:00
|
|
|
ENV LLM_DATABASE_MIGRATIONS_PATH=/app/migrations_llm
|
2022-04-09 14:30:42 +00:00
|
|
|
ENTRYPOINT ["/app/collab"]
|