-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathDockerfile
53 lines (47 loc) · 1.71 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
# Defining environment APP_ENV is 'local' or 'github'
# -> local means local build
# -> github means github action build
ARG APP_ENV=local
#**************************************
# build stages used by local build only
#**************************************
FROM gradle:8.12.1-jdk11 AS temp-build-image
WORKDIR /app
COPY . .
# Install Firefox
RUN echo 'Package: firefox' > /etc/apt/preferences.d/firefox-no-snap && \
echo 'Pin: origin "*.ubuntu.com"' >> /etc/apt/preferences.d/firefox-no-snap && \
echo 'Pin: origin "*.ubuntu.com"' >> /etc/apt/preferences.d/firefox-no-snap && \
echo 'Pin-Priority: -1' >> /etc/apt/preferences.d/firefox-no-snap && \
apt-get update && apt purge firefox &&\
apt-get install -y software-properties-common && \
add-apt-repository ppa:mozillateam/ppa && \
apt-get update && apt-get install -y \
firefox \
--no-install-recommends
RUN rm -rf /var/lib/apt/lists/*
# Build the web application
RUN ./gradlew clean build
RUN cp -R -v ./build/dist/js/productionExecutable ./build/distributions
RUN rm /app/build/distributions/regex-generator.js.map
#**************************************
# end of local build stages
#**************************************
# local build only
FROM alpine:3.21.3 AS local-postinstall
WORKDIR /app
RUN apk update \
&& apk add lighttpd \
&& rm -rf /var/cache/apk/*
COPY --from=temp-build-image /app/build/distributions /var/www/localhost/htdocs
# github action only
FROM alpine:3.21.3 AS github-postinstall
WORKDIR /app
RUN apk update \
&& apk add lighttpd \
&& rm -rf /var/cache/apk/*
COPY build/distributions /var/www/localhost/htdocs
# final stage (maybe empty)
FROM ${APP_ENV}-postinstall AS final
EXPOSE 80
CMD ["lighttpd", "-D", "-f", "/etc/lighttpd/lighttpd.conf"]