-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
124 lines (106 loc) · 4.1 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
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
# Build latest gnubg from sources in latest Alpine Linux
#
# Created: Ingo Macherius <[email protected]>, 2022-02-20
#
# Copyright (C) 1998-2003 Gary Wong <[email protected]>
# Copyright (C) 2000-2022 the AUTHORS
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
FROM alpine:3.15 AS gnubg_builder
ARG GNUBG_INSTALL_DIRECTORY=/gnubg/install
ARG GNUBG_COMPILE_DIRECTORY=/gnubg
ARG GNUBG_PATCH_FILE=./patch/gnubg.patch
# Compiler and development libc
RUN set -ex && \
apk add --no-cache gcc musl-dev
# Toolchain for Linux build
RUN set -ex && \
apk add --no-cache cvs libtool automake autoconf make bison flex file texinfo patch
# Libs
RUN set -ex && \
apk add --no-cache glib-dev
# Download sources
RUN cvs -z7 -d:pserver:[email protected]:/sources/gnubg co gnubg
COPY ${GNUBG_PATCH_FILE} .
RUN patch -s -p0 < gnubg.patch
WORKDIR ${GNUBG_COMPILE_DIRECTORY}
RUN chmod +x autogen.sh && ./autogen.sh
# The binary is meant for use in a FIBS gammonbot, we need only
# an absolute minimum of functionality. So let's exclude the fancy stuff.
# Also, we want to be fast bot, so ramp up compiler optimizations
RUN \
CFLAGS="--pipe -Ofast -march=core2 -mtune=native" \
CC=gcc \
./configure \
--prefix=${GNUBG_INSTALL_DIRECTORY} \
--disable-gasserts \
--without-gtk \
--without-board3d \
--without-sqlite \
--disable-threads \
--without-python \
--without-libcurl \
--disable-cputest\
--enable-simd=sse2
RUN make install && \
rm -f ${GNUBG_INSTALL_DIRECTORY}/bin/bearoffdump \
${GNUBG_INSTALL_DIRECTORY}/bin/makehyper \
${GNUBG_INSTALL_DIRECTORY}/bin/makeweights \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/gnubg.css \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/boards.xml \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/gnubg.gtkrc \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/gnubg.sql \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/textures.txt \
&& rm -rf ${GNUBG_INSTALL_DIRECTORY}/bin/makebearoff \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/Shaders \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/flags \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/fonts \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/scripts \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/textures \
${GNUBG_INSTALL_DIRECTORY}/share/gnubg/sounds \
${GNUBG_INSTALL_DIRECTORY}/share/doc \
${GNUBG_INSTALL_DIRECTORY}/share/man \
&& strip ${GNUBG_INSTALL_DIRECTORY}/bin/gnubg
##################################
FROM alpine:3.15
ARG GNUBG_INSTALL_DIRECTORY=/gnubg/install
ARG GNUBG_COMPILE_DIRECTORY=/gnubg
ARG GBOT_INSTALL_DIRECTORY=/home/gammonbot
ARG GBOT_SOURCE_DIRECTORY=./gbot
# Copy over gnubg binary from builder and install dependencies
RUN mkdir --parents /${GNUBG_INSTALL_DIRECTORY}
# Libs for gnubg
RUN set -ex && \
apk add --no-cache glib
COPY --from=gnubg_builder /${GNUBG_INSTALL_DIRECTORY} /${GNUBG_INSTALL_DIRECTORY}
# Install GammonBot scripts and Perl
RUN mkdir --parents /${GNUBG_INSTALL_DIRECTORY}
# Perl
RUN set -ex && \
apk add --no-cache perl perl-scalar-list-utils perl-time-hires perl-carp
# Python
#RUN set -ex && \
# apk add --no-cache python3
# Install python/pip
#ENV PYTHONUNBUFFERED=1
#RUN apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python
#RUN python3 -m ensurepip
#RUN pip3 install --no-cache --upgrade pip setuptools
RUN apk add gcc g++ make libffi-dev openssl-dev git
#RUN pip3 install pycryptodome
#RUN pip3 install requests
# Copy our scripts
WORKDIR ${GBOT_INSTALL_DIRECTORY}
COPY ${GBOT_SOURCE_DIRECTORY}/* ./
CMD ["/home/gammonbot/entrypoint.sh"]