forked from UnderMybrella/EternalJukebox
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
52 lines (31 loc) · 1.43 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
# set up the main image with dependencies first, to avoid re-doing this after each build
FROM amazoncorretto:8-alpine-jre as deps
WORKDIR /EternalJukebox
RUN wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp \
&& chmod a+rx /usr/local/bin/yt-dlp
RUN apk update \
&& apk add ffmpeg gettext python3 \
&& touch hikari.properties
# build jar with gradle
FROM gradle:8-jdk8 as gradle-build
WORKDIR /home/gradle/project
# Only copy dependency-related files
COPY build.gradle gradle.propertie* settings.gradle ./EternalJukebox/
# Only download dependencies
# Eat the expected build failure since no source code has been copied yet
RUN gradle clean shadowJar --no-daemon > /dev/null 2>&1 || true
COPY . ./EternalJukebox
WORKDIR /home/gradle/project/EternalJukebox
RUN gradle clean shadowJar --no-daemon
# build web with jekyll
FROM rockstorm/jekyll:latest as jekyll-build
WORKDIR /EternalJukebox
COPY --from=gradle-build /home/gradle/project/EternalJukebox .
RUN chmod -R 777 . && jekyll build --source _web --destination web
# copy into main image
FROM deps as main
COPY --from=jekyll-build /EternalJukebox/ ./
COPY --from=gradle-build /home/gradle/project/EternalJukebox/build/libs/* ./
# envsubst is used so environment variables can be used instead of a config file
CMD envsubst < "/EternalJukebox/envvar_config.yaml" > "/EternalJukebox/config.yaml"\
&& java -jar EternalJukebox-all.jar