-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathDockerfile
More file actions
132 lines (119 loc) · 3.69 KB
/
Dockerfile
File metadata and controls
132 lines (119 loc) · 3.69 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
130
131
132
# The runtime image.
FROM php:8.4.8-apache-bookworm
# The koel version to download
ARG KOEL_VERSION_REF=v8.3.1
# Download the koel release matching the version and remove anything not necessary for production
RUN curl -L https://github.com/koel/koel/releases/download/${KOEL_VERSION_REF}/koel-${KOEL_VERSION_REF}.tar.gz | tar -xz -C /tmp \
&& chown www-data:www-data /tmp/koel \
&& chmod 755 /tmp/koel \
&& cd /tmp/koel/ \
&& rm -rf .editorconfig \
.eslintignore \
.eslintrc \
.git \
.gitattributes \
.github \
.gitignore \
.gitmodules \
.gitpod.dockerfile \
.gitpod.yml \
.cursor/ \
.junie/ \
.husky/ \
.vscode/ \
api-docs \
cypress \
cypress.json \
nginx.conf.example \
package.json \
phpstan.neon.dist \
phpunit.xml.dist \
resources/artifacts/ \
ruleset.xml \
scripts/ \
tag.sh \
vite.config.js \
tests/songs/ \
pnpm-lock.yaml \
README.md \
CODE_OF_CONDUCT.md \
tailwind.config.js \
eslint.config.js \
postcss.config.cjs \
commitlint.config.js \
.htaccess.example
# Install koel runtime dependencies.
RUN apt-get update \
&& apt-get install --yes --no-install-recommends \
cron \
libapache2-mod-xsendfile \
libzip-dev \
zip \
ffmpeg \
locales \
libpng-dev \
libjpeg62-turbo-dev \
libpq-dev \
libwebp-dev \
libavif-dev \
# to have a simple editor
nano \
&& docker-php-ext-configure gd --with-jpeg --with-webp --with-avif \
# https://laravel.com/docs/8.x/deployment#server-requirements
# ctype, fileinfo, json, mbstring, openssl, tokenizer and xml are already activated in the base image
&& docker-php-ext-install \
bcmath \
exif \
gd \
pdo \
pdo_mysql \
pdo_pgsql \
pgsql \
zip \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
# Create the music volume so it has the correct permissions
&& mkdir /music \
&& chown www-data:www-data /music \
# Create the search-indexes volume so it has the correct permissions
&& mkdir -p /var/www/html/storage/search-indexes \
&& chown www-data:www-data /var/www/html/storage/search-indexes \
# Set locale to prevent removal of non-ASCII path characters when transcoding with ffmpeg
# See https://github.com/koel/docker/pull/91
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
&& /usr/sbin/locale-gen
# Copy Apache configuration
COPY ./apache.conf /etc/apache2/sites-available/000-default.conf
# Copy php.ini
COPY ./php.ini "$PHP_INI_DIR/php.ini"
# /usr/local/etc/php/php.ini
# Deploy Apache configuration
RUN a2enmod rewrite
# Copy the downloaded release
RUN cp -R /tmp/koel/. /var/www/html \
&& mv /var/www/html/public/manifest.json.example /var/www/html/public/manifest.json \
&& chown -R www-data:www-data /var/www/html
# Volumes for the music files, image storage, and search index
# This declaration must be AFTER creating the folders and setting their permissions
# and AFTER changing to non-root user.
# Otherwise, they are owned by root and the user cannot write to them.
VOLUME ["/music", "/var/www/html/public/img/storage", "/var/www/html/storage/search-indexes"]
RUN cd /var/www/html \
&& php artisan route:cache \
&& php artisan event:cache \
&& php artisan view:cache
ENV FFMPEG_PATH=/usr/bin/ffmpeg \
MEDIA_PATH=/music \
STREAMING_METHOD=x-sendfile \
LANG=en_US.UTF-8 \
LANGUAGE=en_US:en \
LC_ALL=en_US.UTF-8
# Setup bootstrap script.
COPY koel-entrypoint /usr/local/bin/
COPY koel-init /usr/local/bin/
ENTRYPOINT ["koel-entrypoint"]
CMD ["apache2-foreground"]
EXPOSE 80
# Check that the homepage is displayed
HEALTHCHECK --start-period=30s --interval=5m --timeout=5s \
CMD curl -f http://localhost/sw.js || exit 1