Deploy with docker-compose (#1)

Deploy using docker-compose and GitHub Actions.

Created a simple get endpoint to check if server is running on /

Updated address from 127.0.0.1 to 0.0.0.0
This commit is contained in:
Martin Berg Alstad
2024-06-13 14:42:42 +02:00
committed by GitHub
parent 3ad1ad53fc
commit c1b9273e0c
8 changed files with 78 additions and 7 deletions

29
Dockerfile Normal file
View File

@ -0,0 +1,29 @@
# Creates a new cargo project, copies the Cargo.toml and Cargo.lock files to the new project,
# builds the project, and then copies the built binary to a new image.
FROM rust:1.78 as build
LABEL authors="Martin Berg Alstad"
RUN USER=root cargo new --bin simplify_truths
WORKDIR /simplify_truths
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
# this build step will cache your dependencies
RUN cargo build --release
RUN rm src/*.rs
COPY ./src ./src
RUN rm ./target/release/deps/simplify_truths*
RUN cargo build --release
FROM debian
# copy the build artifact from the build stage
COPY --from=build /simplify_truths/target/release/simplify_truths .
EXPOSE 8000
CMD ["./simplify_truths"]