diff --git a/Dockerfile b/Dockerfile index 81a6a9c..6867742 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,13 @@ -# Build image -FROM rust:1.65 as builder - -# Run dummy build to build and cache dependencies that only depends on Cargo.toml and Cargo.lock -WORKDIR /usr/src -RUN USER=root cargo new blessed-rs -COPY Cargo.toml Cargo.lock /usr/src/blessed-rs/ -WORKDIR /usr/src/blessed-rs -RUN cargo build --release - -# Run actual build -COPY ./src ./src -COPY ./data ./data -RUN cargo build --release - -# Run image FROM debian:buster-slim -# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/* -COPY --from=builder /usr/src/blessed-rs/target/release/blessed-rs /usr/local/bin/blessed-rs +EXPOSE 3333 + +COPY target/release/blessed-rs /usr/local/bin/blessed-rs +RUN chmod +x /usr/local/bin/blessed-rs WORKDIR /usr/blessed-rs COPY ./static ./static COPY ./templates ./templates COPY ./data ./data + + CMD ["blessed-rs"] \ No newline at end of file diff --git a/Dockerfile.build b/Dockerfile.build new file mode 100644 index 0000000..81a6a9c --- /dev/null +++ b/Dockerfile.build @@ -0,0 +1,25 @@ +# Build image +FROM rust:1.65 as builder + +# Run dummy build to build and cache dependencies that only depends on Cargo.toml and Cargo.lock +WORKDIR /usr/src +RUN USER=root cargo new blessed-rs +COPY Cargo.toml Cargo.lock /usr/src/blessed-rs/ +WORKDIR /usr/src/blessed-rs +RUN cargo build --release + +# Run actual build +COPY ./src ./src +COPY ./data ./data +RUN cargo build --release + +# Run image +FROM debian:buster-slim +# RUN apt-get update && apt-get install -y extra-runtime-dependencies && rm -rf /var/lib/apt/lists/* +COPY --from=builder /usr/src/blessed-rs/target/release/blessed-rs /usr/local/bin/blessed-rs + +WORKDIR /usr/blessed-rs +COPY ./static ./static +COPY ./templates ./templates +COPY ./data ./data +CMD ["blessed-rs"] \ No newline at end of file diff --git a/Dockerfile.simple b/Dockerfile.simple deleted file mode 100644 index 6867742..0000000 --- a/Dockerfile.simple +++ /dev/null @@ -1,13 +0,0 @@ -FROM debian:buster-slim -EXPOSE 3333 - -COPY target/release/blessed-rs /usr/local/bin/blessed-rs -RUN chmod +x /usr/local/bin/blessed-rs - -WORKDIR /usr/blessed-rs -COPY ./static ./static -COPY ./templates ./templates -COPY ./data ./data - - -CMD ["blessed-rs"] \ No newline at end of file