-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (26 loc) · 1.06 KB
/
Dockerfile
File metadata and controls
32 lines (26 loc) · 1.06 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
# Build environment for clp-ffi-go native library
# Produces portable libclp-ffi-go_linux_{amd64,arm64}.a
#
# Usage:
# # Build for current architecture
# docker build -t clp-ffi-go-builder .
# docker run --rm -v $(pwd)/pre-built:/output clp-ffi-go-builder
#
# # Build for specific architecture (uses QEMU)
# docker buildx build --platform linux/arm64 -t clp-ffi-go-builder:arm64 .
# docker run --rm -v $(pwd)/pre-built:/output clp-ffi-go-builder:arm64
FROM quay.io/pypa/manylinux_2_28_x86_64 AS builder-amd64
FROM quay.io/pypa/manylinux_2_28_aarch64 AS builder-arm64
# Select the right base image based on target platform
ARG TARGETARCH
FROM builder-${TARGETARCH} AS builder
# Install task
RUN curl -fsSL https://taskfile.dev/install.sh | sh -s -- -d -b /usr/local/bin
WORKDIR /src
COPY . .
# Build the library
RUN task cpp:build-release
# Copy to /output on run, fix ownership if HOST_UID is set
CMD task cpp:install-release INSTALL_PREFIX=/output && \
if [ -n "$HOST_UID" ]; then chown -R "$HOST_UID:$HOST_GID" /output; fi && \
echo "Built: $(ls /output/lib/)"