-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile.win64
126 lines (121 loc) · 3.64 KB
/
Dockerfile.win64
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Has to be in the root directory, otherwise the docker build system will not allow copying the necessary files from the host to the container
FROM notcompsky/mxe_amd64-mysql-ffmpeg:latest AS intermediate
WORKDIR /tagem
COPY ffmpegthumbnailer-static.patch /ffmpegthumbnailer-static.patch
COPY server /tagem/server
COPY utils /tagem/utils
ARG libmagic_version=5.39
ARG python_version=3.9.1
RUN apt update \
&& apt install -y curl git tar sed python3 \
\
&& cd /mxe \
&& make libgnurx \
\
&& echo "First make Python of the same version for the host, which is required to cross-compile Python" \
&& curl -s https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz \
| tar xz \
&& cd Python-${python_version} \
&& ./configure \
&& make altinstall \
\
&& curl -s https://www.python.org/ftp/python/${python_version}/Python-${python_version}.tgz \
| tar xz \
&& cd Python-${python_version} \
&& sed -i 's+/* Compiler specific defines */+#define MS_WIN64+g' PC/pyconfig.h \
&& ./configure \
--host=x86_64-w64-mingw32 \
--build=x86_64-pc-linux-gnu \
--enable-static \
--disable-shared \
&& make \
&& make install \
\
&& mkdir py \
&& cd py \
&& curl -s https://www.python.org/ftp/python/${python_version}/python-${python_version}-embed-amd64.zip > py.zip \
&& unzip py.zip \
&& mv python39.dll /usr/lib/python3.9.a \
\
&& git clone --depth 1 https://github.com/lexbor/lexbor \
\
&& curl -s ftp://ftp.astron.com/pub/file/file-${libmagic_version}.tar.gz | tar -xz \
&& cd file-${libmagic_version} \
&& ./configure \
--enable-static \
--disable-shared \
--host=x86_64-w64-mingw32.static \
&& ( \
make && make install || ( \
echo "Tries to build linked executable despite options" \
&& mv src/.libs/libmagic.a /usr/local/lib/libmagic.a \
&& mv src/magic.h /usr/local/include/magic.h \
) \
) \
\
&& git clone --depth 1 https://github.com/Tencent/rapidjson \
&& mv rapidjson/include/rapidjson /usr/include/rapidjson \
\
&& git clone --depth 1 https://github.com/dirkvdb/ffmpegthumbnailer \
&& cd ffmpegthumbnailer \
&& git apply /ffmpegthumbnailer-static.patch \
&& addlocalinclude() { \
mv CMakeLists.txt CMakeLists.old.txt \
&& echo 'include_directories("/usr/local/include" "/usr/include")' > CMakeLists.txt \
&& cat CMakeLists.old.txt >> CMakeLists.txt \
; \
} \
&& addlocalinclude \
&& mkdir build \
&& cd build \
&& x86_64-w64-mingw32.static-cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES=/FFmpeg \
-DENABLE_SHARED=OFF \
-DENABLE_STATIC=ON \
-DENABLE_TESTS=OFF .. \
&& make install \
\
&& git clone --depth 1 https://github.com/NotCompsky/libcompsky \
&& cd libcompsky \
&& addlocalinclude \
&& mkdir build \
&& cd build \
&& x86_64-w64-mingw32.static-cmake \
-DCMAKE_BUILD_TYPE=Release \
-DMYSQL_IS_UNDER_MARIADB_DIR=1 \
-DMYSQL_UNDER_DIR_OVERRIDE=1 \
.. \
&& make install \
\
&& cd /tagem/lexbor \
&& x86_64-w64-mingw32.static-cmake \
-DLEXBOR_BUILD_SHARED=OFF \
-DLEXBOR_BUILD_STATIC=ON \
-DLEXBOR_BUILD_TESTS=OFF \
-DLEXBOR_BUILD_TESTS_CPP=OFF \
-DLEXBOR_BUILD_UTILS=OFF \
-DLEXBOR_BUILD_EXAMPLES=OFF \
-DLEXBOR_BUILD_SEPARATELY=ON \
. \
&& make \
&& make install \
\
&& mv /usr/include/python3.8/* /usr/include/ \
\
&& chmod +x /tagem/server/scripts/* \
&& ( \
rm -rf /tagem/build \
; mkdir /tagem/build \
) && cd /tagem/server \
&& addlocalinclude \
&& cd /tagem/build \
&& LD_LIBRARY_PATH="/usr/local/lib64:$LD_LIBRARY_PATH" cmake \
\
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_STATIC=ON \
-DEMBED_PYTHON=ON \
/tagem/server \
&& make server
FROM alpine:latest
COPY --from=intermediate /tagem/build/server /tagem-server