Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(static): build openssl for fully static corpora in another arm64 linux container #60

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 30 additions & 14 deletions docker/Dockerfile.xcompile
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
# Start with Alpine for its Musl-based minimal footprint
FROM alpine:latest
# Use Alpine for its musl-based environment
FROM alpine:latest as builder

# Install necessary tools and libraries for Rust and Musl
# Install required tools
RUN apk add --no-cache \
musl-dev \
build-base \
musl-dev \
linux-headers \
openssl-dev \
curl \
perl \
git
curl \
git \
gcc \
make

# Install Rust and add the Musl target
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y \
&& source $HOME/.cargo/env \
&& rustup target add x86_64-unknown-linux-musl
# Build OpenSSL statically for musl
WORKDIR /openssl
RUN curl -O -L https://www.openssl.org/source/openssl-3.4.0.tar.gz \
&& tar -xzf openssl-3.4.0.tar.gz \
&& cd openssl-3.4.0 \
&& CC=gcc ./Configure no-shared no-zlib linux-aarch64 \
&& make -j$(nproc) \
&& make install_sw

# Set up environment variables for Musl builds
# Install Rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
ENV PATH="/root/.cargo/bin:$PATH"

# Set the working directory inside the container
# Add musl target
RUN rustup target add aarch64-unknown-linux-musl

# Set environment variables for static linking with OpenSSL
ENV OPENSSL_DIR=/usr/local \
OPENSSL_LIB_DIR=/usr/local/lib \
OPENSSL_INCLUDE_DIR=/usr/local/include \
CC=gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=gcc

# Define working directory
WORKDIR /workspace

# Default command to prevent the container from exiting immediately
# Default command
CMD ["/bin/sh"]
2 changes: 1 addition & 1 deletion py/packages/corpora_proj/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@

if settings.DEBUG:
urlpatterns += [
path("bin/<str:arch>/", BinaryView.as_view(), name="binary"),
path("bin/<str:arch>", BinaryView.as_view(), name="binary"),
]
Loading