-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDockerfile_with_OPL
More file actions
129 lines (110 loc) · 3.74 KB
/
Dockerfile_with_OPL
File metadata and controls
129 lines (110 loc) · 3.74 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
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
127
128
129
# Stage 1: Builder — install all build tools, compile Perl XS modules, generate JS/CSS assets
FROM ubuntu:24.04 AS builder
LABEL org.opencontainers.image.source=https://github.com/openwebwork/renderer
WORKDIR /usr/app
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=America/New_York
RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
apt-utils \
git \
gcc \
make \
curl \
dvipng \
openssl \
libc-dev \
cpanminus \
libssl-dev \
libgd-perl \
zlib1g-dev \
imagemagick \
libdbi-perl \
libjson-perl \
libcgi-pm-perl \
libjson-xs-perl \
ca-certificates \
libstorable-perl \
libdatetime-perl \
libuuid-tiny-perl \
libtie-ixhash-perl \
libhttp-async-perl \
libnet-ssleay-perl \
libarchive-zip-perl \
libcrypt-ssleay-perl \
libclass-accessor-perl \
libstring-shellquote-perl \
libextutils-cbuilder-perl \
libproc-processtable-perl \
libmath-random-secure-perl \
libdata-structure-util-perl \
liblocale-maketext-lexicon-perl \
libyaml-libyaml-perl \
&& curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y --no-install-recommends --no-install-suggests nodejs \
&& apt-get clean \
&& rm -fr /var/lib/apt/lists/* /tmp/*
COPY cpanfile .
RUN cpanm --installdeps . \
&& rm -fr ./cpanm /root/.cpanm /tmp/*
ENV MOJO_MODE=production
# Clones the OPL into the container. Should be the only difference from ./Dockerfile
RUN curl -sOL "https://github.com/openwebwork/webwork-open-problem-library/archive/refs/heads/master.tar.gz"
RUN tar -zxf master.tar.gz
RUN mkdir webwork-open-problem-library
RUN rm master.tar.gz
RUN mv webwork-open-problem-library-master/OpenProblemLibrary/ webwork-open-problem-library/OpenProblemLibrary/
RUN mv webwork-open-problem-library-master/Contrib/ webwork-open-problem-library/Contrib/
RUN rm -r webwork-open-problem-library-master/
COPY . .
RUN cp renderer.conf.dist renderer.conf
RUN cp conf/pg_config.yml lib/PG/conf/pg_config.yml
# Install all npm deps (including devDependencies for asset generation),
# then prune to production-only for the runtime image.
RUN cd public/ && npm install && npm prune --omit=dev && cd ..
RUN cd lib/PG/htdocs && npm install && npm prune --omit=dev && cd ../../..
# Stage 2: Runtime — only what's needed to serve requests
FROM ubuntu:24.04
LABEL org.opencontainers.image.source=https://github.com/openwebwork/renderer
WORKDIR /usr/app
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=America/New_York
ENV MOJO_MODE=production
RUN apt-get update \
&& apt-get install -y --no-install-recommends --no-install-suggests \
apt-utils \
curl \
dvipng \
openssl \
libgd-perl \
imagemagick \
libdbi-perl \
libjson-perl \
libcgi-pm-perl \
libjson-xs-perl \
ca-certificates \
libstorable-perl \
libdatetime-perl \
libuuid-tiny-perl \
libtie-ixhash-perl \
libhttp-async-perl \
libnet-ssleay-perl \
libarchive-zip-perl \
libcrypt-ssleay-perl \
libclass-accessor-perl \
libstring-shellquote-perl \
libproc-processtable-perl \
libmath-random-secure-perl \
libdata-structure-util-perl \
liblocale-maketext-lexicon-perl \
libyaml-libyaml-perl \
&& apt-get clean \
&& rm -fr /var/lib/apt/lists/* /tmp/*
# Copy cpanm-installed Perl modules (XS .so + pure Perl) and Mojo binaries.
# Copies all of /usr/local/ to stay architecture-independent (avoids hardcoding aarch64/x86_64 paths).
COPY --from=builder /usr/local /usr/local
# Copy the full app tree (includes OPL, pruned node_modules, and generated assets)
COPY --from=builder /usr/app /usr/app
EXPOSE 3000
HEALTHCHECK CMD curl -I localhost:3000/health
CMD ["hypnotoad", "-f", "./script/renderer"]