2019-05-11 07:27:21 +04:00
|
|
|
FROM clux/muslrust:stable as builder
|
2018-10-07 16:16:08 +04:00
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
2023-10-13 18:11:23 +04:00
|
|
|
RUN USER=root cargo new crablog
|
|
|
|
WORKDIR /app/crablog
|
2019-04-20 14:28:38 +04:00
|
|
|
|
|
|
|
COPY Cargo.toml Cargo.lock ./
|
|
|
|
|
|
|
|
RUN echo 'fn main() { println!("Dummy") }' > ./src/main.rs
|
2019-05-11 07:27:21 +04:00
|
|
|
|
2018-10-07 16:16:08 +04:00
|
|
|
RUN cargo build --release
|
2019-05-11 07:27:21 +04:00
|
|
|
|
2023-10-13 18:11:23 +04:00
|
|
|
RUN rm -r target/x86_64-unknown-linux-musl/release/.fingerprint/crablog-*
|
2019-04-20 14:28:38 +04:00
|
|
|
|
|
|
|
COPY src src/
|
|
|
|
COPY migrations migrations/
|
|
|
|
COPY templates templates/
|
|
|
|
|
2023-10-13 18:11:23 +04:00
|
|
|
RUN cargo build --release --frozen --bin crablog
|
2019-05-11 06:25:06 +04:00
|
|
|
|
2019-04-20 14:28:38 +04:00
|
|
|
|
2019-05-11 07:27:21 +04:00
|
|
|
FROM alpine:latest
|
2018-12-06 10:39:17 +04:00
|
|
|
|
2023-10-13 18:11:23 +04:00
|
|
|
COPY --from=builder /app/crablog/migrations /application/migrations
|
|
|
|
COPY --from=builder /app/crablog/templates /application/templates
|
|
|
|
COPY --from=builder /app/crablog/target/x86_64-unknown-linux-musl/release/crablog /application/crablog
|
2018-10-08 19:36:07 +04:00
|
|
|
|
|
|
|
EXPOSE 8000
|
2018-10-09 09:58:47 +04:00
|
|
|
|
2023-10-13 18:11:23 +04:00
|
|
|
ENV DATABASE_URL postgres://root@postgres/crablog
|
2018-10-09 09:58:47 +04:00
|
|
|
|
2018-10-08 19:36:07 +04:00
|
|
|
WORKDIR /application
|
2019-05-27 07:58:51 +04:00
|
|
|
|
2023-10-13 18:11:23 +04:00
|
|
|
CMD ["./crablog"]
|