Skip to content

Commit

Permalink
add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Timtam committed Mar 2, 2024
1 parent add59d0 commit 5775831
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Dockerfile
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"]

0 comments on commit 5775831

Please sign in to comment.