2021-07-12 23:14:39 +03:00
|
|
|
# syntax = docker/dockerfile:1.2
|
|
|
|
|
2021-11-07 07:10:27 +03:00
|
|
|
FROM rust:1.56-bullseye as builder
|
2021-07-12 23:14:39 +03:00
|
|
|
WORKDIR app
|
|
|
|
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
|
|
|
|
RUN apt-get install -y nodejs
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Install script dependencies
|
|
|
|
RUN --mount=type=cache,target=./script/node_modules \
|
|
|
|
cd ./script && npm install --quiet
|
|
|
|
|
|
|
|
# Build CSS
|
|
|
|
RUN --mount=type=cache,target=./script/node_modules \
|
|
|
|
script/build-css --release
|
|
|
|
|
|
|
|
# Compile server
|
|
|
|
RUN --mount=type=cache,target=./script/node_modules \
|
|
|
|
--mount=type=cache,target=/usr/local/cargo/registry \
|
|
|
|
--mount=type=cache,target=./target \
|
2021-09-07 20:08:13 +03:00
|
|
|
cargo build --release --package zed-server --bin zed-server
|
2021-07-12 23:14:39 +03:00
|
|
|
|
|
|
|
# Copy server binary out of cached directory
|
|
|
|
RUN --mount=type=cache,target=./target \
|
|
|
|
cp /app/target/release/zed-server /app/zed-server
|
|
|
|
|
|
|
|
# Copy server binary to the runtime image
|
2021-09-13 23:03:00 +03:00
|
|
|
FROM debian:bullseye-slim as runtime
|
2021-07-12 23:14:39 +03:00
|
|
|
RUN apt-get update; \
|
|
|
|
apt-get install -y --no-install-recommends libcurl4-openssl-dev ca-certificates
|
|
|
|
WORKDIR app
|
|
|
|
COPY --from=builder /app/zed-server /app
|
|
|
|
ENTRYPOINT ["/app/zed-server"]
|