28 lines
827 B
Docker
28 lines
827 B
Docker
################
|
|
##### 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"]
|
|
EXPOSE 8000
|
|
|
|
# Run the application
|
|
CMD ["flog"]
|