-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.simple
More file actions
49 lines (44 loc) Β· 1.42 KB
/
Copy pathDockerfile.simple
File metadata and controls
49 lines (44 loc) Β· 1.42 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
FROM rust:1.75-slim
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Add macOS targets
RUN rustup target add x86_64-apple-darwin aarch64-apple-darwin
# Set up build environment
WORKDIR /app
COPY . .
# Create build script
RUN echo '#!/bin/bash\n\
set -e\n\
echo "π¨ Attempting cross-compilation..."\n\
\n\
# Try to build for Intel Mac\n\
echo "Building for Intel Mac..."\n\
if cargo build --release --target x86_64-apple-darwin; then\n\
echo "β
Intel Mac build successful!"\n\
mkdir -p releases\n\
cp target/x86_64-apple-darwin/release/timecard releases/timecard-macos-x86_64 || true\n\
else\n\
echo "β Intel Mac build failed (missing SDK)"\n\
fi\n\
\n\
# Try to build for Apple Silicon\n\
echo "Building for Apple Silicon..."\n\
if cargo build --release --target aarch64-apple-darwin; then\n\
echo "β
Apple Silicon build successful!"\n\
mkdir -p releases\n\
cp target/aarch64-apple-darwin/release/timecard releases/timecard-macos-aarch64 || true\n\
else\n\
echo "β Apple Silicon build failed (missing SDK)"\n\
fi\n\
\n\
echo "π Build results:"\n\
ls -la releases/ 2>/dev/null || echo "No builds completed"\n\
echo ""\n\
echo "π‘ Note: Cross-compilation requires macOS SDK."\n\
echo " For successful builds, use GitHub Actions instead."\n\
' > /opt/build.sh && chmod +x /opt/build.sh
CMD ["/opt/build.sh"]