noheic-convertion
Some checks failed
deploy / deploy (push) Failing after 5s

This commit is contained in:
2024-11-13 11:32:50 +03:00
parent 566379042d
commit b471c66209
5 changed files with 34 additions and 77 deletions

View File

@@ -1,24 +1,30 @@
# Use Debian-based Rust image instead of Alpine
FROM rust:slim-bookworm AS build
# Build stage
FROM rust:slim-bookworm as build
# Install necessary packages
# Install build dependencies
RUN apt-get update && \
apt-get install -y git pkg-config make g++ libssl-dev libheif-dev libheif1 libtiff-dev \
clang libclang-dev pkg-config libde265-dev libx265-dev libjpeg-dev && \
rustup target add x86_64-unknown-linux-gnu
apt-get install -y \
git \
pkg-config \
make \
g++ \
libssl-dev \
libtiff-dev \
clang \
libclang-dev \
pkg-config \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables for libclang
ENV LIBCLANG_PATH=/usr/lib/llvm-14/lib
ENV BINDGEN_EXTRA_CLANG_ARGS="-I/usr/include"
ENV PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig
ENV PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
ENV PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
# Add target
RUN rustup target add x86_64-unknown-linux-gnu
# Create a new Rust binary project
# Create a new empty shell project
RUN USER=root cargo new --bin quoter
WORKDIR /quoter
# Copy Cargo files to cache dependencies
# Copy manifests
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
@@ -29,33 +35,26 @@ RUN cargo build --release
# Remove the default source file created by cargo new
RUN rm src/*.rs
# Copy your source code into the container
# Copy source code
COPY ./src ./src
# Build the application for release
# Build for release
RUN rm ./target/release/deps/quoter*
RUN cargo build --release
# Use Debian slim for the final stage
# Final stage
FROM debian:bookworm-slim
ENV RUST_BACKTRACE=full
ENV RUST_LOG=warn
# Install runtime dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libssl3 \
libheif1 \
libtiff6 \
libde265-0 \
libx265-199 \
libjpeg62-turbo \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy the compiled binary from the build stage
# Copy the build artifact from the build stage
COPY --from=build /quoter/target/release/quoter .
ENV PORT=8080
EXPOSE 8080
# Set the startup command
CMD ["./quoter"]