From ea790a066a0dce5995bbc8441027337e4380d885 Mon Sep 17 00:00:00 2001 From: Gunwant Jain Date: Wed, 30 Dec 2020 04:20:39 +0530 Subject: [PATCH] Dockerised the app Good use of env vars now Signed-off-by: Gunwant Jain --- Dockerfile | 19 +++++++++++++++++++ docker-compose.yml | 15 +++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..496b3e4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM rustlang/rust:nightly-slim AS builder +WORKDIR app +COPY . . +RUN cargo build --release + +FROM debian:buster-slim AS runtime +WORKDIR app +RUN apt-get update -y \ + && apt-get autoremove -y \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /app/target/release/bin bin +RUN mkdir -p upload +COPY ./templates templates +ENV ROCKET_ADDRESS=0.0.0.0 +ENV ROCKET_PORT=6162 + +ENTRYPOINT ["./bin"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..55e3187 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3.3' +services: + pastebin: + build: + context: . + restart: always + container_name: pastebin + ports: + - 127.0.0.1:6162:6162 + environment: + - ROCKET_PORT=6162 + - THEME=gruvbox-dark # By default, it uses the Ayu Colorscheme + - HOST=localhost:6162 # or bin.example.com + volumes: + - ./upload:/app/upload # upload folder will have your pastes