-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
50 lines (42 loc) · 1.56 KB
/
Dockerfile
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
FROM faasm.azurecr.io/cpp-sysroot:0.4.0
ARG FAASM_PYTHON_VERSION
SHELL ["/bin/bash", "-c"]
ENV PYTHON_DOCKER="on"
RUN apt update && apt install -y libssl-dev
# Clone code and submodules
RUN mkdir -p /code \
&& git clone \
-b v${FAASM_PYTHON_VERSION} \
https://github.com/faasm/python \
/code/python \
&& cd /code/python \
&& git submodule update --init -f third-party/cpp \
&& git submodule update --init -f third-party/cpython \
&& git submodule update --init -f third-party/crossenv \
&& git config --global --add safe.directory /code/python
# Cross-compile CPython to WASM and the python libraries
RUN cd /code/python \
&& ./bin/create_venv.sh \
&& source ./venv/bin/activate \
# Buld and install a native CPython and a cross-compiled CPython with the
# same version. Also cross-compile the entrypoint function for CPython
&& inv \
cpython.native \
cpython.wasm \
cpython.func
# Build cross-compiled python modules, including `pyfaasm`
RUN cd /code/python \
&& ./bin/crossenv_setup.sh \
&& source ./cross_venv/bin/activate \
&& pip3 install -r crossenv/requirements.txt \
&& inv -r crossenv modules.build
# Finally, install the cross-compiled Python modules
RUN cd /code/python \
&& source ./venv/bin/activate \
&& inv modules.install
# TODO: Install experimental pacakges
# RUN . ./cross_venv/bin/activate && inv libs.install --experimental
WORKDIR /code/python
ENV TERM xterm-256color
RUN sed -i 's/\/code\/cpp\/bin/\/code\/python\/bin/g' ~/.bashrc
CMD ["/bin/bash", "-l"]