slim-buster2
This commit is contained in:
parent
2979146b34
commit
956468b0c8
31
Dockerfile
31
Dockerfile
|
@ -1,40 +1,49 @@
|
|||
FROM rust:slim-buster AS build
|
||||
# Use a specific Rust version that is compatible with your dependencies
|
||||
FROM rust:1.81-slim-buster AS build
|
||||
|
||||
# Print system information for debugging
|
||||
RUN uname -a
|
||||
RUN cat /etc/os-release # print ubuntu version
|
||||
RUN cat /etc/os-release
|
||||
|
||||
# had to add this for open-ssl
|
||||
# Install necessary packages
|
||||
RUN apt-get update -y && \
|
||||
apt-get install -y git pkg-config make g++ libssl-dev wget \
|
||||
libheif-dev libtiff-dev libtiff5-dev && \
|
||||
libheif-dev libtiff-dev && \
|
||||
rustup target add x86_64-unknown-linux-gnu
|
||||
|
||||
# Create a new Rust binary project
|
||||
RUN USER=root cargo new --bin quoter
|
||||
WORKDIR /quoter
|
||||
|
||||
# Copy Cargo files to cache dependencies
|
||||
COPY ./Cargo.lock ./Cargo.lock
|
||||
COPY ./Cargo.toml ./Cargo.toml
|
||||
|
||||
# cache dependencies
|
||||
# Cache dependencies
|
||||
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
|
||||
RUN cargo build --release
|
||||
|
||||
# Remove the default source file created by cargo new
|
||||
RUN rm src/*.rs
|
||||
|
||||
# copy your source tree
|
||||
# Copy your source code into the container
|
||||
COPY ./src ./src
|
||||
|
||||
# build for release
|
||||
RUN rm ./target/release/deps/quoter*
|
||||
# Build the application for release
|
||||
RUN cargo build --release
|
||||
|
||||
FROM rust:slim-buster
|
||||
# Use a minimal runtime image for the final stage
|
||||
FROM debian:buster-slim
|
||||
|
||||
ENV RUST_BACKTRACE=full
|
||||
ENV RUST_LOG=warn
|
||||
|
||||
RUN apt-get update && apt install -y openssl libssl-dev \
|
||||
libheif1 libtiff5
|
||||
# Install runtime dependencies
|
||||
RUN apt-get update && apt-get install -y openssl libssl-dev \
|
||||
libheif1 libtiff5 && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy the compiled binary from the build stage
|
||||
COPY --from=build /quoter/target/release/quoter .
|
||||
|
||||
ENV PORT=8080
|
||||
|
|
Loading…
Reference in New Issue
Block a user