forked from AzuraCast/AzuraCast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
187 lines (140 loc) · 4.57 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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#
# Golang dependencies build step
#
FROM golang:1.20-bullseye AS go-dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends openssl git
RUN go install github.com/jwilder/[email protected]
RUN go install github.com/aptible/[email protected]
RUN go install github.com/centrifugal/centrifugo/[email protected]
#
# MariaDB dependencies build step
#
FROM mariadb:10.9-jammy AS mariadb
#
# Final build image
#
FROM ubuntu:jammy AS pre-final
ENV TZ="UTC"
# Add Go dependencies
COPY --from=go-dependencies /go/bin/dockerize /usr/local/bin
COPY --from=go-dependencies /go/bin/supercronic /usr/local/bin/supercronic
COPY --from=go-dependencies /go/bin/centrifugo /usr/local/bin/centrifugo
# Add MariaDB dependencies
COPY --from=mariadb /usr/local/bin/healthcheck.sh /usr/local/bin/db_healthcheck.sh
COPY --from=mariadb /usr/local/bin/docker-entrypoint.sh /usr/local/bin/db_entrypoint.sh
# Run base build process
COPY ./util/docker/common /bd_build/
RUN bash /bd_build/prepare.sh \
&& bash /bd_build/add_user.sh
# Build each set of dependencies in their own step for cacheability.
COPY ./util/docker/supervisor /bd_build/supervisor/
RUN bash /bd_build/supervisor/setup.sh
COPY ./util/docker/stations /bd_build/stations/
RUN bash /bd_build/stations/setup.sh
COPY ./util/docker/web /bd_build/web/
RUN bash /bd_build/web/setup.sh
COPY ./util/docker/mariadb /bd_build/mariadb/
RUN bash /bd_build/mariadb/setup.sh
COPY ./util/docker/redis /bd_build/redis/
RUN bash /bd_build/redis/setup.sh
COPY ./util/docker/docs /bd_build/docs/
RUN bash /bd_build/docs/setup.sh
RUN bash /bd_build/cleanup.sh \
&& rm -rf /bd_build
USER azuracast
RUN touch /var/azuracast/.docker
USER root
VOLUME ["/var/azuracast/stations", "/var/azuracast/uploads", "/var/azuracast/backups", "/var/azuracast/sftpgo/persist", "/var/azuracast/servers/shoutcast2", "/var/azuracast/meilisearch/persist"]
#
# Development Build
#
FROM pre-final AS development
# Dev build step
COPY ./util/docker/common /bd_build/
COPY ./util/docker/dev /bd_build/dev
RUN bash /bd_build/dev/setup.sh \
&& bash /bd_build/cleanup.sh \
&& rm -rf /bd_build
USER azuracast
WORKDIR /var/azuracast/www
COPY --chown=azuracast:azuracast . .
RUN composer install --no-ansi --no-interaction
WORKDIR /var/azuracast/www/frontend
RUN npm ci --include=dev
WORKDIR /var/azuracast/www
USER root
EXPOSE 80 443 2022
EXPOSE 8000-8999
# Sensible default environment variables.
ENV TZ="UTC" \
LANG="en_US.UTF-8" \
PATH="${PATH}:/var/azuracast/servers/shoutcast2" \
DOCKER_IS_STANDALONE="true" \
APPLICATION_ENV="development" \
MYSQL_HOST="localhost" \
MYSQL_PORT=3306 \
MYSQL_USER="azuracast" \
MYSQL_PASSWORD="azur4c457" \
MYSQL_DATABASE="azuracast" \
ENABLE_REDIS="true" \
REDIS_HOST="localhost" \
REDIS_PORT=6379 \
REDIS_DB=1 \
NGINX_RADIO_PORTS="default" \
NGINX_WEBDJ_PORTS="default" \
COMPOSER_PLUGIN_MODE="false" \
ADDITIONAL_MEDIA_SYNC_WORKER_COUNT=0 \
PROFILING_EXTENSION_ENABLED=1 \
PROFILING_EXTENSION_ALWAYS_ON=0 \
PROFILING_EXTENSION_HTTP_KEY=dev \
PROFILING_EXTENSION_HTTP_IP_WHITELIST=* \
ENABLE_WEB_UPDATER="false"
# Entrypoint and default command
ENTRYPOINT ["tini", "--", "/usr/local/bin/my_init"]
CMD ["--no-main-command"]
#
# Final build (Just environment vars and squishing the FS)
#
FROM ubuntu:jammy AS final
COPY --from=pre-final / /
USER azuracast
WORKDIR /var/azuracast/www
COPY --chown=azuracast:azuracast ./composer.json ./composer.lock ./
RUN composer install \
--no-dev \
--no-ansi \
--no-autoloader \
--no-interaction
COPY --chown=azuracast:azuracast . .
RUN composer dump-autoload --optimize --classmap-authoritative
USER root
EXPOSE 80 443 2022
EXPOSE 8000-8999
# Sensible default environment variables.
ENV TZ="UTC" \
LANG="en_US.UTF-8" \
PATH="${PATH}:/var/azuracast/servers/shoutcast2" \
DOCKER_IS_STANDALONE="true" \
APPLICATION_ENV="production" \
MYSQL_HOST="localhost" \
MYSQL_PORT=3306 \
MYSQL_USER="azuracast" \
MYSQL_PASSWORD="azur4c457" \
MYSQL_DATABASE="azuracast" \
ENABLE_REDIS="true" \
REDIS_HOST="localhost" \
REDIS_PORT=6379 \
REDIS_DB=1 \
NGINX_RADIO_PORTS="default" \
NGINX_WEBDJ_PORTS="default" \
COMPOSER_PLUGIN_MODE="false" \
ADDITIONAL_MEDIA_SYNC_WORKER_COUNT=0 \
PROFILING_EXTENSION_ENABLED=0 \
PROFILING_EXTENSION_ALWAYS_ON=0 \
PROFILING_EXTENSION_HTTP_KEY=dev \
PROFILING_EXTENSION_HTTP_IP_WHITELIST=* \
ENABLE_WEB_UPDATER="true"
# Entrypoint and default command
ENTRYPOINT ["tini", "--", "/usr/local/bin/my_init"]
CMD ["--no-main-command"]