-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.build_all
85 lines (74 loc) · 2.62 KB
/
Dockerfile.build_all
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
FROM amazonlinux:2023
RUN yum update -y && \
yum upgrade -y && \
yum install -y \
clang \
cmake \
libcurl-devel \
git \
bzip2 \
python3 \
npm \
tar \
less \
nginx \
sqlite \
wget \
which && \
yum clean all
# download boost 1.84
# build boost
RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.84.0/source/boost_1_84_0.tar.bz2 && \
tar xjvf boost_1_84_0.tar.bz2 && \
cd boost_1_84_0 && \
./bootstrap.sh --with-toolset=clang --prefix=/usr/local && \
./b2 --with-system -j$(nproc) install && \
cd / && \
rm -rf boost*
# download retrosheet files
RUN wget https://www.retrosheet.org/alldata.zip
# make directories, run scripts to extract data from retrosheet files
# into Sqlite3 DB
RUN mkdir /baseball/alldata && \
mkdir /baseball && \
mkdir /baseball/webapp && \
mkdir /baseball/vite-baseball-stats && \
unzip -d /baseball/alldata alldata.zip
# copy files
# don't use bulk copy to avoid copying over junk/temp files
# use extraneous ARG to ignore cache after this point (force recopy)
# change ARG at command line to forcd the rebuild
ARG UPDATE_BUILD
COPY ./*.py /baseball
COPY ["./webapp/*.c*", "./webapp/*.h*", "/webapp/CMakeLists.txt", "./webapp/build.sh", "/baseball/webapp"]
COPY ./webapp/vite-baseball-stats /baseball/webapp/vite-baseball-stats
RUN cd /baseball && \
./retrosheet_init_db.py && \
./retrosheet_data_to_sql.py && \
./retrosheet_boxscores_to_sql.py
RUN cd /baseball && \
./retrosheet_parse_event_outcomes.py 0 50000 && \
./retrosheet_parse_event_outcomes.py 50000 100000 && \
./retrosheet_parse_event_outcomes.py 100000 120000 && \
./retrosheet_parse_event_outcomes.py 120000 140000 && \
./retrosheet_parse_event_outcomes.py 140000 150000 && \
./retrosheet_parse_event_outcomes.py 150000 160000 && \
./retrosheet_parse_event_outcomes.py 170000 180000 && \
./retrosheet_parse_event_outcomes.py 180000 190000 && \
./retrosheet_parse_event_outcomes.py 190000 200000 && \
sqlite3 baseball.db < create_situation_indexes.sql && \
mv baseball.db webapp && \
rm -r alldata
# build backend and front end
# replace server name in requests.js
# bundle front and backend into tar archive
ARG SERVER_NAME=switchfielder.com
RUN cd /baseball/webapp && \
sed -i -e 's/server=.*/server="$SERVER_NAME"/' \
vite-baseball-stats/src/js/requests.js && \
./build.sh && \
tar cf dist.tar httpd baseball.db && \
cd vite-baseball-stats && \
tar rf ../dist.tar dist && \
cd .. && \
bzip2 dist.tar