chore: add cross Dockerfile

This commit is contained in:
Jesús Pérez 2025-12-18 01:20:02 +00:00
parent 85529123c8
commit 3bf715982c
Signed by: jesus
GPG Key ID: 9F243E355E0BC939
2 changed files with 112 additions and 0 deletions

62
.gitignore vendored Normal file
View File

@ -0,0 +1,62 @@
CLAUDE.md
.claude
COMMIT_MESSAGE.md
wrks
nushell
nushell-*
*.tar.gz
#*-nushell-plugins.tar.gz
github-com
.coder
target
distribution
.qodo
# enviroment to load on bin/build
.env
# OSX trash
.DS_Store
# Vscode files
.vscode
# Emacs save files
*~
\#*\#
.\#*
# Vim-related files
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
# cscope-related files
cscope.*
# User cluster configs
.kubeconfig
.tags*
# direnv .envrc files
.envrc
# make-related metadata
/.make/
# Just in time generated data in the source, should never be committed
/test/e2e/generated/bindata.go
# This file used by some vendor repos (e.g. github.com/go-openapi/...) to store secret variables and should not be ignored
!\.drone\.sec
# Godeps workspace
/Godeps/_workspace
/bazel-*
*.pyc
# generated by verify-vendor.sh
vendordiff.patch
.claude/settings.local.json

50
Dockerfile.cross Normal file
View File

@ -0,0 +1,50 @@
# Dockerfile for cross-platform compilation
# Supports building for multiple targets using docker
FROM ubuntu:22.04
# Install build essentials
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
ENV PATH="/root/.cargo/bin:${PATH}"
# Install cross tool for cross-compilation
RUN cargo install cross
# Create workspace directory
WORKDIR /workspace
# Copy entire project
COPY . .
# Default build target
ARG TARGET=x86_64-unknown-linux-gnu
ENV BUILD_TARGET="${TARGET}"
# Build command
RUN cross build --target "${BUILD_TARGET}" --release
# Extract binaries to output directory
RUN mkdir -p /output/bin && \
for binary in typedialog typedialog-tui typedialog-web; do \
if [ -f "target/${BUILD_TARGET}/release/${binary}" ]; then \
cp "target/${BUILD_TARGET}/release/${binary}" /output/bin/ || \
cp "target/${BUILD_TARGET}/release/${binary}.exe" /output/bin/; \
fi; \
done
# Copy configuration
RUN cp -r config /output/
# Create manifest
RUN echo "{ \"target\": \"${BUILD_TARGET}\", \"built\": \"$(date -u +'%Y-%m-%dT%H:%M:%SZ')\" }" > /output/BUILD_INFO.json
# Default command
CMD ["/bin/bash"]