diff --git a/Cargo.toml b/Cargo.toml index f359a51..46b01a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Jef Roosens "] edition = "2018" [lib] -name = "fej_lib" +name = "fej" src = "src/lib.rs" test = true bench = true @@ -13,8 +13,8 @@ doc = true doctest = true [[bin]] -name = "fej" -src = "src/main.rs" +name = "server" +src = "src/bin/server/main.rs" test = false bench = false doc = false diff --git a/docker/Dockerfile.dev b/docker/Dockerfile.dev index 9205fd4..d2029af 100644 --- a/docker/Dockerfile.dev +++ b/docker/Dockerfile.dev @@ -3,4 +3,4 @@ FROM chewingbever/fej-builder:latest ENV RUST_BACKTRACE 1 ENTRYPOINT ["cargo"] -CMD ["run"] +CMD ["run", "--bin", "server"] diff --git a/docker/Dockerfile.rel b/docker/Dockerfile.rel index 6b4e438..b64916a 100644 --- a/docker/Dockerfile.rel +++ b/docker/Dockerfile.rel @@ -7,7 +7,7 @@ FROM chewingbever/fej-builder:latest AS builder # NOTE: cargo install auto-appends bin to the path RUN --mount=type=cache,target=/usr/src/app/target \ --mount=type=cache,target=/root/.cargo/registry \ - cargo install --path . --bin fej --root /usr/local + cargo install --path . --root /usr/local # Now, we create the actual image @@ -17,7 +17,7 @@ FROM alpine:latest RUN apk update && apk add --no-cache openssl libgcc curl # Copy binary over to final image -COPY --from=builder /usr/local/bin/fej /usr/local/bin/fej +COPY --from=builder /usr/local/bin/server /usr/local/bin/server HEALTHCHECK \ --interval=10s \ @@ -26,4 +26,4 @@ HEALTHCHECK \ --retries=3 \ CMD curl -q localhost:8000 -CMD ["/usr/local/bin/fej"] +CMD ["/usr/local/bin/server"] diff --git a/src/main.rs b/src/bin/server/main.rs similarity index 97% rename from src/main.rs rename to src/bin/server/main.rs index 8b8edc7..a27e00f 100644 --- a/src/main.rs +++ b/src/bin/server/main.rs @@ -1,7 +1,7 @@ #[macro_use] extern crate rocket; -use fej_lib::{catchers, ivago}; +use fej::{catchers, ivago}; // Very temporary solution for CORS // https://stackoverflow.com/questions/62412361/how-to-set-up-cors-or-options-for-rocket-rs