-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (26 loc) · 881 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
##
## Shurly
##
# Base builder image
FROM rust:1.80-slim AS builder
# Very nice
WORKDIR /usr/src/shurly
# Add the entire source
COPY . .
# We setup a SQLx cache file of our schema to support building without a database connection
ENV SQLX_OFFLINE=true
# We be building!
RUN --mount=type=cache,target=/usr/src/shurly/target \
--mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
cargo build --release; \
# move binary out of cached directory, so the runtime can copy it
objcopy --compress-debug-sections target/release/shurly ./shurly
# Lean, mean, image machine
FROM gcr.io/distroless/cc AS runtime
# It's us
LABEL org.opencontainers.image.source=https://github.com/workplacebuddy/shurly
# Just the Shurly binary
COPY --from=builder /usr/src/shurly/shurly /
# Run, Shurly, run!
ENTRYPOINT ["./shurly"]