forked from Limero/mulle.js
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathDockerfile
More file actions
92 lines (70 loc) · 2.31 KB
/
Copy pathDockerfile
File metadata and controls
92 lines (70 loc) · 2.31 KB
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
# Override this step with additional_contexts in docker-compose.yml if ISO is outside project directory
FROM scratch AS iso
ARG GAME_LANG=sv
COPY ./iso/mullebil_${GAME_LANG}.iso mullebil_${GAME_LANG}.iso
COPY ./iso/plugin.exe plugin.exe
FROM python:3.11 AS builder_py
ARG GAME_LANG=sv
ARG OPTIPNG_LEVEL=7
WORKDIR /build
# Copy build scripts
COPY ./build_scripts ./build_scripts
COPY ./requirements.txt .
COPY ./assets.py .
COPY ./audiosprite ./audiosprite
# Copy game data
COPY --from=iso mullebil_${GAME_LANG}.iso ./iso/mullebil_${GAME_LANG}.iso
COPY --from=iso plugin.exe ./iso/plugin.exe
# Install dependencies
RUN apt-get update && apt-get -y install ffmpeg optipng
RUN pip install -r requirements.txt
# Unpack iso
RUN python build_scripts/build.py ${GAME_LANG} download
# Create output folders
RUN mkdir -p dist/info/img
# Build scores and assets
RUN python build_scripts/build.py ${GAME_LANG} scores
RUN python assets.py ${OPTIPNG_LEVEL} assets_${GAME_LANG}
# Convert and copy UI images
RUN python build_scripts/build.py ui-images
# Build topograhy images
RUN python build_scripts/topography.py ./cst_out_new/CDDATA.CXT/Standalone ./topography
FROM node:18-bookworm AS builder_js
ARG SERVER_ADDRESS
ENV SERVER_ADDRESS=${SERVER_ADDRESS}
WORKDIR /build
# Install dependencies
COPY ./package.json .
COPY ./package-lock.json .
RUN npm install
# Build topography sprite sheet
COPY --from=builder_py /build/topography ./topography
COPY ./build_scripts/topography.js .
RUN node ./topography.js ./topography
# Copy source
COPY ./src ./src
COPY ./webpack.common.js .
COPY ./webpack.prod.js .
# Build webpack
RUN npx webpack-cli -c webpack.prod.js
# Build sass
RUN npm install -g sass
RUN sass ./src/style.scss ./dist/style.css
FROM httpd:bookworm AS web_run
EXPOSE 80
ARG GAME_LANG=sv
WORKDIR /usr/local/apache2/htdocs
# Copy built assets
COPY --from=builder_py /build/assets_${GAME_LANG} ./assets
COPY --from=builder_js /build/dist .
COPY --from=builder_py /build/dist .
# Copy topograpchy sprite sheet
RUN mkdir ./assets/topography
COPY --from=builder_js /build/topography/topography.json ./assets/topography
COPY --from=builder_js /build/topography/topography.png ./assets/topography
# Copy static files from source
COPY ./src/index_cdn.html ./index.html
COPY ./data ./data
COPY ./info ./info
COPY ./progress ./progress
RUN echo ${GAME_LANG}