mirror of
https://github.com/amigan/rustypaste-pretty.git
synced 2024-11-21 20:09:48 -05:00
fix(docker): switch to Rust image as builder for Dockerfile
This commit is contained in:
parent
240907c53a
commit
c5389a1200
1 changed files with 7 additions and 5 deletions
12
Dockerfile
12
Dockerfile
|
@ -1,5 +1,7 @@
|
||||||
FROM ekidd/rust-musl-builder:latest as builder
|
FROM rust:1.67.0-alpine3.17 as builder
|
||||||
WORKDIR /home/rust/src
|
WORKDIR /app
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add --no-cache musl-dev
|
||||||
COPY Cargo.toml Cargo.toml
|
COPY Cargo.toml Cargo.toml
|
||||||
RUN mkdir -p src/
|
RUN mkdir -p src/
|
||||||
RUN echo "fn main() {println!(\"failed to build\")}" > src/main.rs
|
RUN echo "fn main() {println!(\"failed to build\")}" > src/main.rs
|
||||||
|
@ -8,14 +10,14 @@ RUN rm -f target/release/deps/rustypaste*
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN cargo build --locked --release
|
RUN cargo build --locked --release
|
||||||
RUN mkdir -p build-out/
|
RUN mkdir -p build-out/
|
||||||
RUN cp target/x86_64-unknown-linux-musl/release/rustypaste build-out/
|
RUN cp target/release/rustypaste build-out/
|
||||||
RUN strip build-out/rustypaste
|
RUN strip build-out/rustypaste
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=builder \
|
COPY --from=builder \
|
||||||
/home/rust/src/build-out/rustypaste \
|
/app/build-out/rustypaste \
|
||||||
/home/rust/src/config.toml ./
|
/app/config.toml ./
|
||||||
ENV SERVER__ADDRESS=0.0.0.0:8000
|
ENV SERVER__ADDRESS=0.0.0.0:8000
|
||||||
EXPOSE 8000
|
EXPOSE 8000
|
||||||
USER 1000:1000
|
USER 1000:1000
|
||||||
|
|
Loading…
Reference in a new issue