This commit is contained in:
parent
012678a8a7
commit
ab98010224
26
Dockerfile
26
Dockerfile
|
@ -1,18 +1,14 @@
|
|||
# Use a specific Rust version that is compatible with your dependencies
|
||||
FROM rust:alpine AS build
|
||||
|
||||
# Print system information for debugging
|
||||
RUN uname -a
|
||||
RUN cat /etc/os-release
|
||||
# Use Debian-based Rust image instead of Alpine
|
||||
FROM rust:slim-bookworm AS build
|
||||
|
||||
# Install necessary packages
|
||||
RUN apk update && \
|
||||
apk add git pkgconf make g++ openssl openssl-dev libheif libheif-dev tiff tiff-dev \
|
||||
clang clang-dev llvm-dev llvm-static musl-dev && \
|
||||
rustup target add x86_64-unknown-linux-musl
|
||||
RUN apt-get update && \
|
||||
apt-get install -y git pkg-config make g++ libssl-dev libheif-dev libtiff-dev \
|
||||
clang libclang-dev && \
|
||||
rustup target add x86_64-unknown-linux-gnu
|
||||
|
||||
# Set environment variables for libclang
|
||||
ENV LIBCLANG_PATH=/usr/lib
|
||||
ENV LIBCLANG_PATH=/usr/lib/llvm-14/lib
|
||||
ENV BINDGEN_EXTRA_CLANG_ARGS="-I/usr/include"
|
||||
|
||||
# Create a new Rust binary project
|
||||
|
@ -36,14 +32,16 @@ COPY ./src ./src
|
|||
# Build the application for release
|
||||
RUN cargo build --release
|
||||
|
||||
# Use a minimal runtime image for the final stage
|
||||
FROM alpine:latest
|
||||
# Use Debian slim for the final stage
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
ENV RUST_BACKTRACE=full
|
||||
ENV RUST_LOG=warn
|
||||
|
||||
# Install runtime dependencies
|
||||
RUN apk update && apk add --no-cache openssl libheif tiff
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends libssl3 libheif1 libtiff5 && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy the compiled binary from the build stage
|
||||
COPY --from=build /quoter/target/release/quoter .
|
||||
|
|
Loading…
Reference in New Issue
Block a user