2023-01-30 13:03:42 -05:00
|
|
|
FROM rust:1.67.0-alpine3.17 as builder
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apk update
|
|
|
|
RUN apk add --no-cache musl-dev
|
2021-07-25 07:47:48 -04:00
|
|
|
COPY Cargo.toml Cargo.toml
|
|
|
|
RUN mkdir -p src/
|
|
|
|
RUN echo "fn main() {println!(\"failed to build\")}" > src/main.rs
|
|
|
|
RUN cargo build --release
|
|
|
|
RUN rm -f target/release/deps/rustypaste*
|
|
|
|
COPY . .
|
|
|
|
RUN cargo build --locked --release
|
|
|
|
RUN mkdir -p build-out/
|
2023-01-30 13:03:42 -05:00
|
|
|
RUN cp target/release/rustypaste build-out/
|
2021-07-25 07:47:48 -04:00
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder \
|
2023-01-30 13:03:42 -05:00
|
|
|
/app/build-out/rustypaste \
|
|
|
|
/app/config.toml ./
|
2021-07-25 07:47:48 -04:00
|
|
|
ENV SERVER__ADDRESS=0.0.0.0:8000
|
|
|
|
EXPOSE 8000
|
|
|
|
USER 1000:1000
|
|
|
|
CMD ["./rustypaste"]
|