Rustelo/templates/shared/docker/Dockerfile.cross
Jesús Pérez 0d0297423e
Some checks failed
CI/CD Pipeline / Test Suite (push) Has been cancelled
CI/CD Pipeline / Security Audit (push) Has been cancelled
CI/CD Pipeline / Performance Benchmarks (push) Has been cancelled
Rust CI / Security Audit (push) Has been cancelled
Rust CI / Check + Test + Lint (nightly) (push) Has been cancelled
Rust CI / Check + Test + Lint (stable) (push) Has been cancelled
CI/CD Pipeline / Build Docker Image (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Cleanup (push) Has been cancelled
chore: fix with CI and pre-commit
2026-02-08 20:37:49 +00:00

59 lines
1.7 KiB
Docker

# Multi-stage Dockerfile for cross-compilation
# This image provides Rust + Node.js toolchain for building Rustelo applications
ARG RUST_VERSION={{rust_version}}
ARG NODE_VERSION={{node_version}}
# Build stage with full toolchain
FROM node:${NODE_VERSION}-slim as base
# Install system dependencies for Rust and cross-compilation
RUN apt-get update && apt-get install -y \
curl \
build-essential \
pkg-config \
libssl-dev \
libsqlite3-dev \
musl-tools \
gcc-musl-dev \
&& rm -rf /var/lib/apt/lists/*
# Install Rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_VERSION}
ENV PATH="/root/.cargo/bin:${PATH}"
# Add cross-compilation targets
RUN rustup target add x86_64-unknown-linux-gnu
RUN rustup target add aarch64-unknown-linux-gnu
RUN rustup target add x86_64-unknown-linux-musl
# Install additional tools for Rustelo development
RUN cargo install wasm-pack --version {{wasm_pack_version}}
RUN cargo install trunk --version {{trunk_version}}
RUN cargo install just --version {{just_version}}
# Set up workspace
WORKDIR /workspace
# Install global Node.js dependencies commonly used by Rustelo projects
RUN npm install -g \
pnpm@{{pnpm_version}} \
@tailwindcss/cli@{{tailwind_version}} \
sass@{{sass_version}}
# Create volume directories for persistent storage
RUN mkdir -p /workspace/target /workspace/node_modules
# Copy cross-build script
COPY scripts/cross-build.sh /usr/local/bin/cross-build
RUN chmod +x /usr/local/bin/cross-build
# Set default environment variables
ENV CARGO_HOME=/root/.cargo
ENV CARGO_TARGET_DIR=/workspace/target
ENV NODE_ENV=production
ENV RUSTELO_MODE=cross
# Default command
CMD ["cross-build"]