forked from blacksky-algorithms/rsky
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (31 loc) · 1.33 KB
/
Copy pathDockerfile
File metadata and controls
40 lines (31 loc) · 1.33 KB
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
38
39
40
# Use the official Rust image.
# https://hub.docker.com/_/rust
FROM --platform=linux/amd64 rust AS builder
# Copy local code to the container image.
WORKDIR /usr/src/rsky
COPY Cargo.toml Cargo.lock rust-toolchain ./
COPY rsky-lexicon rsky-lexicon
COPY rsky-identity rsky-identity
COPY rsky-syntax rsky-syntax
COPY rsky-pds/Cargo.toml rsky-pds/Cargo.toml
COPY rsky-crypto rsky-crypto
COPY rsky-feedgen rsky-feedgen
COPY rsky-firehose rsky-firehose
COPY rsky-common rsky-common
COPY rsky-labeler rsky-labeler
COPY rsky-repo rsky-repo
COPY rsky-jetstream-subscriber rsky-jetstream-subscriber
# Create an empty src directory to trick Cargo into thinking it's a valid Rust project
RUN mkdir rsky-pds/src && echo "fn main() {}" > rsky-pds/src/main.rs
# Install production dependencies and build a release artifact.
RUN cargo build --release --package rsky-pds
# Now copy the real source code and build the final binary
COPY rsky-pds/src rsky-pds/src
COPY rsky-pds/migrations rsky-pds/migrations
COPY rsky-pds/diesel.toml rsky-pds/diesel.toml
RUN cargo build --release --package rsky-pds
FROM --platform=linux/amd64 rust
WORKDIR /usr/src/rsky
COPY --from=builder /usr/src/rsky/target/release/rsky-pds rsky-pds
# Run the web service on container startup with the same environment variables
CMD ["sh", "-c", "ROCKET_PORT=$PORT ROCKET_ADDRESS=0.0.0.0 ./rsky-pds"]