Skip to content

Commit

Permalink
another try
Browse files Browse the repository at this point in the history
  • Loading branch information
sunce86 committed Oct 24, 2024
1 parent dbf939f commit 5e9d5bb
Showing 1 changed file with 12 additions and 19 deletions.
31 changes: 12 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
# Stage 1: Build the Rust binaries
FROM docker.io/rust:1-slim-bookworm as cargo-build
# Use a Rust base image
FROM rust:1-slim-bookworm

# Set the working directory
WORKDIR /src/

# Install dependencies
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update && \
apt-get install -y git libssl-dev pkg-config
# Install necessary dependencies
RUN apt-get update && \
apt-get install -y libssl-dev pkg-config && \
apt-get clean

# Copy the source code into the container
COPY . .

# Build the application
RUN --mount=type=cache,target=/usr/local/cargo/registry --mount=type=cache,target=/src/target \
CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release
# Build the application with verbose output
RUN CARGO_PROFILE_RELEASE_DEBUG=1 cargo build --release

# Stage 2: Create an intermediate image for dependencies
FROM docker.io/debian:bookworm-slim as intermediate
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked apt-get update && \
apt-get install -y ca-certificates tini gettext-base && \
apt-get clean

# Stage 3: Create the final image
FROM intermediate as final
RUN apt-get update && \
apt-get install -y build-essential cmake git zlib1g-dev libelf-dev libdw-dev libboost-dev libboost-iostreams-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libunwind-dev libzstd-dev git
COPY --from=cargo-build /src/target/release/data-migration /usr/local/bin/data-migration
# Copy the compiled binary to a more appropriate location
RUN cp target/release/data-migration /usr/local/bin/data-migration

# Ensure the binary is executable
RUN chmod +x /usr/local/bin/data-migration
Expand Down

0 comments on commit 5e9d5bb

Please sign in to comment.