Skip to content
Snippets Groups Projects
  • Hugo Trentesaux's avatar
    bfb85c07
    add Dockerfile (!31) · bfb85c07
    Hugo Trentesaux authored
    * working dockerfile
    
    * wip dockerfile
    
    TODO make duniter-polkadot-sdk repo lighter to avoid long download time in docker build
    
    (cherry picked from commit 5f4b716f)
    
    * update subxt and polkadot sdk
    bfb85c07
    History
    add Dockerfile (!31)
    Hugo Trentesaux authored
    * working dockerfile
    
    * wip dockerfile
    
    TODO make duniter-polkadot-sdk repo lighter to avoid long download time in docker build
    
    (cherry picked from commit 5f4b716f)
    
    * update subxt and polkadot sdk
Dockerfile 1019 B
# FROM rustlang/rust:nightly-slim as build
# nightly needed for -Zgit=shallow-deps build but ahash problem with stdsimd
FROM rust:latest as build
# # Use musl Rust image
# FROM clux/muslrust:1.75.0-stable as build

WORKDIR /app

# Copy the Cargo.toml and Cargo.lock files to leverage Docker's caching mechanism
COPY Cargo.toml Cargo.lock ./

# Build the dependencies of the application separately
RUN --mount=type=cache,target=/app/target \
    --mount=type=cache,target=/root/.cargo/registry \
    mkdir src \
    && echo "fn main() {}" > src/main.rs \
    && cargo build --release \
    && rm -r src

# Copy the rest of the source code
COPY ./res ./res
COPY ./src ./src

# Build the application
RUN cargo build --release

# Start release stage
FROM debian as release

# Set the working directory to the location of the built application
WORKDIR /app

# Copy the built application from the previous stage
COPY --from=build /app/target/release/gcli .

# Specify the entrypoint for the container
ENTRYPOINT ["/app/gcli"]