-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
64 lines (49 loc) · 1.88 KB
/
Dockerfile
File metadata and controls
64 lines (49 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Multi-stage build to optimize final image size
FROM rust:1.82 as builder
# Install system dependencies required for compilation
RUN apt-get update && apt-get install -y \
build-essential \
pkg-config \
cmake \
libclang-dev \
clang \
&& rm -rf /var/lib/apt/lists/*
# Create working directory
WORKDIR /app
# Copy project files
COPY Cargo.toml Cargo.lock ./
COPY src/ ./src/
# Compile in release mode with native optimizations
RUN RUSTFLAGS="-C target-cpu=native" cargo build --release
# Final stage with smaller image
FROM debian:bookworm-slim
# Install only necessary runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user for security
RUN useradd -r -s /bin/false cgdist
# Copy compiled binary
COPY --from=builder /app/target/release/cgdist /usr/local/bin/cgdist
# Ensure binary is executable
RUN chmod +x /usr/local/bin/cgdist
# Create directory for data
RUN mkdir -p /data && chown cgdist:cgdist /data
# Switch to non-root user
USER cgdist
# Working directory for data
WORKDIR /data
# Entry point
ENTRYPOINT ["/usr/local/bin/cgdist"]
# Default help if no arguments are passed
CMD ["--help"]
# Metadata
LABEL maintainer="andrea.deruvo@gssi.it"
LABEL description="cgDist: Ultra-fast SNP/indel-level distance calculator for core genome MLST analysis"
LABEL version="0.1.0"
LABEL org.opencontainers.image.title="cgDist"
LABEL org.opencontainers.image.description="High-performance tool for calculating pairwise SNP and indel distances between bacterial isolates using core genome MLST allelic profiles with sequence alignment"
LABEL org.opencontainers.image.vendor="GenPat-IT Bioinformatics"
LABEL org.opencontainers.image.licenses="MIT"
LABEL org.opencontainers.image.source="https://github.com/genpat-it/cgDist"
LABEL org.opencontainers.image.documentation="https://github.com/genpat-it/cgDist"