From 0612c1adb9b6e336787b992fbef29be52b119d27 Mon Sep 17 00:00:00 2001 From: Kilerd Chan Date: Thu, 6 Dec 2018 14:39:17 +0800 Subject: [PATCH] fix: remove dependency of docker image --- Dockerfile | 6 +++++- docker-compose.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index 2177f48..01ff4b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,14 @@ COPY . /app WORKDIR /app +RUN cargo install diesel_cli --no-default-features --features postgres +RUN mkdir -p /out && cp /root/.cargo/bin/diesel /out/ RUN cargo build --release -FROM clux/diesel-cli +FROM alpine:latest + +COPY --from=builder /out/diesel /bin/ COPY --from=builder /app/migrations /application/migrations COPY --from=builder /app/Rocket.toml /application/Rocket.toml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b073762 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: "3" +services: + rubble: + image: kilerd/rubble + ports: + - "9999:8000" + environment: + DATABASE_URL: postgres://root:password@postgres/rubble + ROCKET_SECRET_KEY: Bqgzqe3zIg2siAS6IBUmL9/50GOW1xDBpxXZgSpFbyM= + depends_on: + - postgres + networks: + - backend + + postgres: + image: postgres:9-alpine + restart: always + environment: + POSTGRES_USER: root + POSTGRES_PASSWORD: password + POSTGRES_DB: rubble + networks: + - backend + +networks: + backend: \ No newline at end of file