migrate Dockerfile away from rust-musl-builder
This commit is contained in:
parent
ff3bf42342
commit
11b846ac38
43
Dockerfile
43
Dockerfile
|
@ -1,34 +1,29 @@
|
||||||
FROM ekidd/rust-musl-builder:beta as build
|
FROM rust:alpine3.14 as builder
|
||||||
|
|
||||||
USER rust
|
WORKDIR /app
|
||||||
WORKDIR /home/rust/src/
|
RUN apk add musl-dev
|
||||||
RUN USER=rust cargo new datatrash
|
|
||||||
|
|
||||||
WORKDIR /home/rust/src/datatrash
|
RUN cargo init
|
||||||
COPY --chown=rust Cargo.toml Cargo.lock ./
|
COPY Cargo.toml Cargo.lock ./
|
||||||
RUN cargo build --release
|
RUN cargo build --release --target=x86_64-unknown-linux-musl
|
||||||
|
|
||||||
COPY --chown=rust src ./src
|
COPY src ./src
|
||||||
COPY --chown=rust static ./static
|
COPY static ./static
|
||||||
COPY --chown=rust template ./template
|
COPY template ./template
|
||||||
COPY --chown=rust snippet ./snippet
|
COPY snippet ./snippet
|
||||||
COPY --chown=rust init-db.sql ./init-db.sql
|
COPY init-db.sql ./init-db.sql
|
||||||
RUN touch src/main.rs
|
RUN touch src/main.rs
|
||||||
RUN cargo build --release
|
RUN cargo build --release --target=x86_64-unknown-linux-musl
|
||||||
RUN strip target/x86_64-unknown-linux-musl/release/datatrash
|
RUN strip /app/target/x86_64-unknown-linux-musl/release/datatrash
|
||||||
|
|
||||||
FROM alpine:latest
|
|
||||||
|
|
||||||
ENV RUST_BACKTRACE "1"
|
|
||||||
|
|
||||||
RUN mkdir /opt/datatrash
|
FROM alpine:3.14
|
||||||
|
|
||||||
WORKDIR /opt/datatrash
|
WORKDIR /opt/datatrash
|
||||||
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/datatrash ./
|
||||||
COPY --from=build \
|
COPY static ./static
|
||||||
/home/rust/src/datatrash/target/x86_64-unknown-linux-musl/release/datatrash \
|
RUN mkdir ./files
|
||||||
/opt/datatrash/
|
|
||||||
COPY static /opt/datatrash/static
|
|
||||||
RUN mkdir /opt/datatrash/files
|
|
||||||
|
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
ENTRYPOINT ["/opt/datatrash/datatrash"]
|
ENTRYPOINT ["datatrash"]
|
||||||
|
|
Loading…
Reference in New Issue