-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from Chia-Network/EL.alpine
Add alpine container for musl wheel builds
- Loading branch information
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Build Alpine Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "alpine/*" | ||
- ".github/workflows/build-alpine.yml" | ||
pull_request: | ||
paths: | ||
- "alpine/*" | ||
- ".github/workflows/build-alpine.yml" | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "30 12 * * 5" | ||
|
||
concurrency: | ||
# SHA is added to the end if on `main` to let all main workflows run | ||
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
uses: Chia-Network/actions/.github/workflows/docker-build.yaml@main | ||
with: | ||
alternate-latest-mode: true | ||
docker-context: "./alpine" | ||
docker-platforms: linux/amd64 | ||
dockerfile: "./alpine/Dockerfile" | ||
dockerhub_imagename: "chianetwork/alpine-builder" | ||
image_subpath: "alpine-builder" | ||
secrets: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_PAT: ${{ secrets.DOCKERHUB_PAT }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM alpine:3.16.2 | ||
WORKDIR /root | ||
|
||
# Set environment variables for rust and pyenv | ||
ENV PYENV_ROOT=/root/.pyenv | ||
ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH" | ||
ENV PATH="/root/.cargo/bin:${PATH}" | ||
ENV RUST_BACKTRACE=1 | ||
|
||
RUN sh -c "echo https://mirrors.edge.kernel.org/alpine/v3.16.2/community >> /etc/apk/repositories" | ||
RUN apk add bash git curl python3 openssl openssl-dev perl linux-headers make gcc musl-dev patch patchelf | ||
# Additional pyenv dependencies | ||
RUN apk add --no-cache build-base libffi-dev bzip2-dev zlib-dev xz-dev readline-dev sqlite-dev tk-dev | ||
|
||
# Install Rust | ||
RUN curl --proto '=https' --tlsv1.2 -sSf -o rustup https://sh.rustup.rs | ||
RUN sh ./rustup -y | ||
|
||
# Build a copy of openssl - needed for the rust-openssl crate | ||
COPY build-openssl.sh . | ||
RUN sh ./build-openssl.sh | ||
|
||
RUN curl https://pyenv.run | bash && \ | ||
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --skip-existing 3.8 && \ | ||
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --skip-existing 3.9 && \ | ||
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --skip-existing 3.10 && \ | ||
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --skip-existing 3.11 && \ | ||
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --skip-existing 3.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
|
||
ln -s /usr/include/x86_64-linux-gnu/asm /usr/include/x86_64-linux-musl/asm | ||
ln -s /usr/include/asm-generic /usr/include/x86_64-linux-musl/asm-generic | ||
ln -s /usr/include/linux /usr/include/x86_64-linux-musl/linux | ||
|
||
mkdir /musl | ||
|
||
wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1w.tar.gz | ||
tar zxvf OpenSSL_1_1_1w.tar.gz | ||
cd openssl-OpenSSL_1_1_1w/ || exit | ||
|
||
CC="/usr/bin/x86_64-alpine-linux-musl-gcc -static" ./Configure no-shared no-async --prefix=/musl --openssldir=/musl/ssl linux-x86_64 | ||
make depend | ||
make -j"$(nproc)" | ||
make install |