This commit is contained in:
parent
2ae841560b
commit
ec8016cc36
1 changed files with 37 additions and 0 deletions
37
Dockerfile
Normal file
37
Dockerfile
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
FROM rust:alpine AS chef
|
||||
RUN apk add --no-cache openssl-dev musl-dev openssl-libs-static lld git g++ make cmake
|
||||
RUN cargo install cargo-chef
|
||||
WORKDIR /app
|
||||
|
||||
FROM chef AS planner
|
||||
COPY . .
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM chef AS builder
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
|
||||
ENV OPENSSL_LIB_DIR=/usr/lib
|
||||
ENV OPENSSL_INCLUDE_DIR=/usr/include/openssl
|
||||
ENV OPENSSL_STATIC=1
|
||||
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,target=/app/target \
|
||||
cargo chef cook --release --recipe-path recipe.json --target x86_64-unknown-linux-musl
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN --mount=type=cache,target=/usr/local/cargo/registry \
|
||||
--mount=type=cache,target=/app/target \
|
||||
cargo build --release --target x86_64-unknown-linux-musl && \
|
||||
mkdir -p /app/dist && \
|
||||
cp /app/target/x86_64-unknown-linux-musl/release/tagaya /app/dist/
|
||||
|
||||
FROM alpine:latest AS final
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/dist/tagaya ./tagaya
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENTRYPOINT ["./tagaya"]
|
||||
Loading…
Reference in a new issue