-
Notifications
You must be signed in to change notification settings - Fork 202
/
Dockerfile
70 lines (53 loc) · 1.65 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
FROM ubuntu:22.04 AS build_sdk
ARG PG_VERSION
ARG SDK_VERSION
ARG DEBUG=false
ARG OBJDUMP=true
ENV \
PG_VERSION=$PG_VERSION \
SDK_VERSION=$SDK_VERSION \
SDKROOT=/opt/python-wasm-sdk \
SYS_PYTHON=/usr/bin/python3 \
DEBUG=$DEBUG \
BUILDS=3.12 \
EMFLAVOUR=latest
WORKDIR /workspace
# Install dependencies to build python-wasm-sdk
RUN \
apt-get update &&\
apt-get install -y \
sudo patchelf git clang unzip autoconf libtool \
libsqlite3-dev libffi-dev libssl-dev zlib1g-dev pkg-config \
libncursesw5-dev python3 python3-pip \
make build-essential wget lz4 bzip2 pv curl
# Download the python-wasm-sdk source for the given version
RUN git clone --depth 1 --branch ${SDK_VERSION} https://github.com/pygame-web/python-wasm-sdk.git
# Remove third party libraries that are not necessary for PGLite
RUN cd ./python-wasm-sdk/sources.wasm && rm assimp.sh bullet3.sh ode.sh
# Make python-wasm-sdk
RUN cd ./python-wasm-sdk && chmod +x ./python-wasm-sdk.sh && bash -c "./python-wasm-sdk.sh"
FROM ubuntu:22.04
ARG PG_VERSION
ARG SDK_VERSION
ARG DEBUG=false
ARG OBJDUMP=true
ENV \
PG_VERSION=$PG_VERSION \
SDK_VERSION=$SDK_VERSION \
SDK_ARCHIVE=python3.12-wasm-sdk-Ubuntu-22.04.tar \
SDKROOT=/opt/python-wasm-sdk \
SYS_PYTHON=/usr/bin/python3 \
PGROOT=/tmp/pglite \
DEBUG=$DEBUG \
OBJDUMP=$OBJDUMP
WORKDIR /workspace
COPY --from=0 /tmp/sdk /tmp/sdk
# Install dependencies to build postgres wasm
RUN \
apt-get update &&\
apt-get install -y lz4 wget pv bash curl bzip2 python3 build-essential &&\
apt-get clean
# Extract SDK
RUN cd / && tar xvf /tmp/sdk/${SDK_ARCHIVE} | pv -p -l -s 24400 >/dev/null
# Clean up packaged SDK
RUN rm -rf /tmp/sdk