-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM rust:1.76-slim-bookworm as build | ||
|
||
# create a new empty shell project | ||
RUN USER=root cargo new --bin hitster | ||
WORKDIR /hitster | ||
|
||
# copy over your manifests | ||
COPY ./server/Cargo.toml ./Cargo.toml | ||
|
||
# this build step will cache your dependencies | ||
RUN cargo build --release | ||
RUN rm src/*.rs | ||
|
||
# copy your source tree | ||
COPY ./server/migrations ./migrations | ||
COPY ./server/src ./src | ||
COPY ./server/build.rs ./build.rs | ||
COPY ./server/etc ./etc | ||
|
||
# build for release | ||
RUN rm ./target/release/deps/hitster* | ||
RUN cargo build --release | ||
|
||
# our final base | ||
FROM debian:bookworm-slim | ||
|
||
# copy the build artifact from the build stage | ||
COPY --from=build /hitster/target/release/hitster-server ./hitster | ||
|
||
# set the startup command to run your binary | ||
CMD ["./hitster"] |