-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.arm64
81 lines (67 loc) · 1.66 KB
/
Dockerfile.arm64
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
FROM node:20-bookworm-slim AS uibase
# update system and install required packages
RUN <<EOF
apt update -y
apt install -y wget sqlite3
npm install -g @angular/cli
EOF
# copy code to build
WORKDIR /app-code/
COPY . .
# build angular ui
RUN <<EOF
cd ui
npm install
ng build --configuration production
EOF
# copy ui build to release directory
WORKDIR /app/browser
RUN cp /app-code/ui/dist/ui/browser/ /app/ -rv
# get latest yt-dlp
WORKDIR /app/utils
RUN <<EOF
wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux_aarch64
mv yt-dlp_linux_aarch64 yt-dlp_linux
chmod +x /app/utils/yt-dlp_linux
EOF
# make directories and copy required files
WORKDIR /app
RUN <<EOF
mkdir ./database/scripts ./database/db -p
cp /app-code/database/scripts/* /app/database/scripts/
cp /app-code/.env /app/.env
cp /app-code/entrypoint.sh /app/entrypoint.sh
mkdir application content
EOF
# init database
WORKDIR /app/database/db
RUN <<EOF
sqlite3 streamsphere.db < ../scripts/create.sql | bash
sqlite3 streamsphere.db < ../scripts/seed.sql | bash
EOF
# stage 2 starts here for application build
FROM golang:1.22.8-bookworm AS appbase
COPY --from=uibase /app-code/ /app-code/
COPY --from=uibase /app/ /app/
WORKDIR /app-code
RUN <<EOF
cd cmd
go build
cp cmd /app/application/streamsphere -rv
chmod +x /app/application/streamsphere
EOF
# stage 3 copy application to bookworm lts as final
FROM debian:bookworm-slim AS final
RUN <<EOF
apt update -y && apt upgrade -y
apt install -y gettext-base ffmpeg
EOF
COPY --from=appbase /app/ /app/
EXPOSE 3000
# make entrypoint script executable
WORKDIR /app/
RUN <<EOF
chmod +x /app/entrypoint.sh | bash
EOF
# CMD ["/bin/bash"]
CMD ["./entrypoint.sh"]