-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.Dockerfile
37 lines (28 loc) · 1.05 KB
/
server.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
36
37
# ====================================================================
# = =
# = NodeForum Backend Server =
# = =
# ====================================================================
# Create the NodeForum builder
FROM rust:latest as builder
# Install musl tools
RUN apt-get update && \
apt-get -y install \
musl musl-dev musl-tools
# Install the Rust toolchain
RUN rustup target add $(uname -m)-unknown-linux-musl
# Add the code
ADD ./packages/backend /app
WORKDIR /app
# Compile NodeForum
RUN RUSTFLAGS="-C target-feature=+crt-static" cargo build \
--release --target $(uname -m)-unknown-linux-musl
# Copy the binary
RUN cp /app/target/$(uname -m)-unknown-linux-musl/release/nodeforum /app/nodeforum
# Create the binary-only image
FROM scratch
# Copy the binary
COPY --from=builder /app/nodeforum /nodeforum
# Set the start command
ENTRYPOINT [ "/nodeforum" ]
CMD [ "/nodeforum" ]