mirror of
https://codeberg.org/icewind/shelve.git
synced 2026-06-03 12:04:09 +02:00
update dockerfile
This commit is contained in:
parent
e7c6b72d27
commit
fed5c3def3
1 changed files with 17 additions and 8 deletions
25
Dockerfile
25
Dockerfile
|
|
@ -1,16 +1,25 @@
|
|||
FROM ekidd/rust-musl-builder AS build
|
||||
FROM rust AS build
|
||||
|
||||
ADD . ./
|
||||
RUN sudo chown -R rust:rust .
|
||||
RUN rustup target add x86_64-unknown-linux-musl
|
||||
|
||||
RUN cargo build --release
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
|
||||
FROM alpine:latest
|
||||
# Build with a dummy main to pre-build dependencies
|
||||
RUN mkdir src && \
|
||||
echo "fn main(){}" > src/main.rs && \
|
||||
cargo build --release --target x86_64-unknown-linux-musl && \
|
||||
rm -r src
|
||||
|
||||
COPY --from=build /home/rust/src/target/x86_64-unknown-linux-musl/release/shelve /
|
||||
RUN mkdir /data
|
||||
ADD ./target/x86_64-unknown-linux-musl/release/shelve /
|
||||
COPY src/ ./src/
|
||||
COPY templates/ ./templates/
|
||||
|
||||
RUN touch src/main.rs && cargo build --release --target x86_64-unknown-linux-musl
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=build /target/x86_64-unknown-linux-musl/release/shelve /
|
||||
EXPOSE 80
|
||||
ENV ROCKET_PORT=80
|
||||
ENV ROCKET_ADDRESS=0.0.0.0
|
||||
|
||||
CMD ["/shelve"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue