2024-02-04 06:44:58 +00:00
|
|
|
FROM rust:alpine as builder
|
|
|
|
|
|
|
|
RUN apk add musl-dev
|
2022-12-11 15:33:16 +00:00
|
|
|
|
|
|
|
RUN mkdir /app
|
|
|
|
WORKDIR /app
|
|
|
|
|
2024-02-04 06:44:58 +00:00
|
|
|
ARG RUSTFLAGS="-C target-feature=+crt-static"
|
|
|
|
|
2022-12-11 15:33:16 +00:00
|
|
|
COPY Cargo.toml /app
|
|
|
|
COPY Cargo.lock /app
|
|
|
|
COPY src /app/src
|
|
|
|
COPY templates /app/templates
|
|
|
|
|
2024-02-04 06:44:58 +00:00
|
|
|
RUN cargo build --release --target=x86_64-unknown-linux-musl
|
|
|
|
|
|
|
|
RUN strip -s /app/target/x86_64-unknown-linux-musl/release/paste-frontend && \
|
|
|
|
strip -R .comment -R .note -R .note.ABI-tag /app/target/x86_64-unknown-linux-musl/release/paste-frontend
|
|
|
|
|
|
|
|
FROM scratch
|
2022-12-11 17:55:28 +00:00
|
|
|
WORKDIR /app
|
2024-02-04 06:44:58 +00:00
|
|
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/paste-frontend /app/paste-frontend
|
2022-12-11 17:55:28 +00:00
|
|
|
ADD templates /app/templates
|
2022-12-21 17:56:41 +00:00
|
|
|
ADD static /app/static
|
2022-12-11 17:01:05 +00:00
|
|
|
EXPOSE 8080
|
2022-12-11 17:55:28 +00:00
|
|
|
CMD ["./paste-frontend"]
|