-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.build_env_musl
More file actions
50 lines (38 loc) · 1.37 KB
/
Copy pathDockerfile.build_env_musl
File metadata and controls
50 lines (38 loc) · 1.37 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
50
# Dockerfile to build human-datetime.py extension with an Alpine image.
# Python 3.13 will be installed via uv as it is the version compatible with the extension.
# This image which will produce a musl compatible build whereas the Ubuntu based image produces glibc.
FROM alpine:latest
# Install build dependencies, ldc2 compiler, uv and git
RUN sed -i '2s/^# *//' /etc/apk/repositories
RUN apk update && apk add --no-cache build-base bash ldc uv git
# Create build directory.
RUN mkdir -p /usr/build/source
WORKDIR /usr/build
# Test bash installed.
RUN bash --version
# Test gcc installed.
RUN gcc --version
# Test ldc2 installed.
RUN ldc2 --version
# Test uv installed.
RUN uv --version
# Test git installed.
RUN git --version
# Install Python 3.13 (compatible with the human_datetime_py ext module)
RUN uv python install 3.13
# Test Python installed.
RUN uv run python --version
# Install human_datetime_py ext module dependencies
# Also build it and install it to site_packages
COPY requirements_ldc.txt ./
COPY *.py ./
COPY source/*.d ./source/
RUN uv venv /usr/build/.venv && uv pip install -r requirements_ldc.txt
ENV VIRTUAL_ENV=/usr/build/.venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY libpython3.13.a ./
COPY build_ext_container.sh ./
# Mark run script as executable
RUN chmod +x build_ext_container.sh
# Build the extension and keep container running.
CMD [ "./build_ext_container.sh" ]