Skip to content

Commit

Permalink
Use alpine base image and a builder stage
Browse files Browse the repository at this point in the history
  • Loading branch information
rien authored and redfast00 committed Aug 21, 2020
1 parent 919c4dc commit 6b3ea1e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git/
target/
Dockerfile
docker-compose.yml
shell.nix
nix/
openapi/
17 changes: 14 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
FROM rustlang/rust:nightly-buster
FROM rustlang/rust:nightly-alpine AS builder

WORKDIR /usr/src/zauth

RUN apt-get update && apt-get install -y netcat
RUN apk add --no-cache musl-dev mariadb-connector-c-dev postgresql-dev sqlite-dev

RUN cargo install diesel_cli
COPY . .
RUN cargo install --path .

FROM alpine

WORKDIR /usr/src/zauth

RUN apk add --no-cache netcat-openbsd libpq
COPY --from=builder /usr/local/cargo/bin/diesel /usr/local/cargo/bin/zauth /usr/local/bin/
COPY Rocket.toml diesel.toml /usr/src/zauth/
COPY migrations/ migrations/
COPY docker_misc/ docker_misc/
COPY static/ static/

ENV ROCKET_ENV production
CMD ["zauth"]
CMD ["zauth"]

0 comments on commit 6b3ea1e

Please sign in to comment.