mirror of
https://github.com/house-of-vanity/OutFleet.git
synced 2025-12-16 17:37:51 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cabdd3aad3 | ||
|
|
8d10a4deef | ||
|
|
eaf7f95cd3 | ||
|
|
b96c520f9d |
38
Dockerfile
38
Dockerfile
@@ -1,22 +1,15 @@
|
|||||||
# Use cargo-chef for dependency caching
|
# Build stage with Rust
|
||||||
FROM lukemathwalker/cargo-chef:0.1.68-rust-1.90-slim AS chef
|
FROM rust:1.90-bookworm AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install system dependencies needed for building
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
protobuf-compiler \
|
protobuf-compiler \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Recipe preparation stage
|
|
||||||
FROM chef AS planner
|
|
||||||
COPY . .
|
|
||||||
RUN cargo chef prepare --recipe-path recipe.json
|
|
||||||
|
|
||||||
# Dependency building stage
|
|
||||||
FROM chef AS builder
|
|
||||||
|
|
||||||
# Build arguments
|
# Build arguments
|
||||||
ARG GIT_COMMIT="development"
|
ARG GIT_COMMIT="development"
|
||||||
ARG GIT_COMMIT_SHORT="dev"
|
ARG GIT_COMMIT_SHORT="dev"
|
||||||
@@ -31,15 +24,26 @@ ENV BUILD_DATE=${BUILD_DATE}
|
|||||||
ENV BRANCH_NAME=${BRANCH_NAME}
|
ENV BRANCH_NAME=${BRANCH_NAME}
|
||||||
ENV CARGO_VERSION=${CARGO_VERSION}
|
ENV CARGO_VERSION=${CARGO_VERSION}
|
||||||
|
|
||||||
# Copy recipe and build dependencies (cached layer)
|
# Copy dependency files first for caching
|
||||||
COPY --from=planner /app/recipe.json recipe.json
|
COPY Cargo.toml Cargo.lock ./
|
||||||
RUN cargo chef cook --release --recipe-path recipe.json
|
|
||||||
|
|
||||||
# Copy source and build application
|
# Create dummy source files to build dependencies
|
||||||
COPY . .
|
RUN mkdir -p src && \
|
||||||
|
echo "fn main() {}" > src/main.rs && \
|
||||||
|
echo "pub fn lib() {}" > src/lib.rs
|
||||||
|
|
||||||
|
# Build dependencies (this layer will be cached)
|
||||||
|
RUN cargo build --release && \
|
||||||
|
rm -rf src target/release/deps/xray_admin* target/release/xray-admin*
|
||||||
|
|
||||||
|
# Copy actual source code
|
||||||
|
COPY src ./src
|
||||||
|
COPY static ./static
|
||||||
|
|
||||||
|
# Build the application
|
||||||
RUN cargo build --release --locked
|
RUN cargo build --release --locked
|
||||||
|
|
||||||
# Runtime stage - minimal Ubuntu image for glibc compatibility
|
# Runtime stage - Ubuntu for glibc compatibility
|
||||||
FROM ubuntu:24.04 AS runtime
|
FROM ubuntu:24.04 AS runtime
|
||||||
|
|
||||||
# Build arguments (needed for runtime stage)
|
# Build arguments (needed for runtime stage)
|
||||||
|
|||||||
Reference in New Issue
Block a user