Dockerfile ok

This commit is contained in:
Justine 2023-01-15 13:24:15 +01:00
parent 6b605483f9
commit 06aae255ba
15 changed files with 25 additions and 6 deletions

View File

@ -1,8 +1,27 @@
FROM rust:1.66.0-alpine3.17
COPY ./flog /opt/flog
WORKDIR /opt/flog
################
##### Builder
FROM rust:1.66.0-slim as builder
WORKDIR /usr/src
RUN USER=root cargo new flog-docker
COPY flog/Cargo.toml flog/Cargo.lock /usr/src/flog-docker/
WORKDIR /usr/src/flog-docker
RUN rustup target add x86_64-unknown-linux-musl
RUN cargo build --target x86_64-unknown-linux-musl --release
COPY flog/src /usr/src/flog-docker/src/
RUN touch /usr/src/flog-docker/src/main.rs
RUN cargo build --target x86_64-unknown-linux-musl --release
################
##### Runtime
FROM alpine:3.16.0 AS runtime
RUN mkdir /opt/flog
COPY --from=builder /usr/src/flog-docker/target/x86_64-unknown-linux-musl/release/flog /usr/local/bin
ADD base_site/html /opt/flog/html
ADD base_site/templates /opt/flog/templates
VOLUME ["/opt/flog/html"]
VOLUME ["/opt/flog/templates"]
RUN apk add build-base make bash
RUN cargo build
EXPOSE 80
EXPOSE 8000
# Run the application
CMD ["/usr/local/bin/flog-docker"]

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB