Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ARG KOEL_VERSION_REF=v7.14.0

# 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 \
Expand Down Expand Up @@ -73,12 +75,6 @@ RUN apt-get update \
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 \
Expand All @@ -99,16 +95,32 @@ RUN cp -R /tmp/koel/. /var/www/html
RUN [ ! -f /var/www/html/public/manifest.json ] && cp /var/www/html/public/manifest.json.example /var/www/html/public/manifest.json || true
RUN chown -R www-data:www-data /var/www/html

# Create /tmp/koel if it doesn't exist, and set ownership to www-data
RUN mkdir -p /tmp/koel \
&& chown www-data:www-data /tmp/koel \
&& chmod 755 /tmp/koel
RUN mkdir /music \
&& chown www-data:www-data /music \
&& mkdir -p /images/artists \
&& mkdir -p /images/avatars \
&& mkdir -p /images/covers \
&& mkdir -p /images/playlists \
&& mkdir -p /images/radio-stations \
&& chown -R www-data:www-data /images \
&& chmod -R 755 /images \
&& rm -r /var/www/html/public/img/artists \
&& rm -r /var/www/html/public/img/avatars \
&& rm -r /var/www/html/public/img/covers \
&& rm -r /var/www/html/public/img/playlists \
&& rm -r /var/www/html/public/img/radio-stations \
&& ln -s /images/artists /var/www/html/public/img/artists \
&& ln -s /images/avatars /var/www/html/public/img/avatars \
&& ln -s /images/covers /var/www/html/public/img/covers \
&& ln -s /images/playlists /var/www/html/public/img/playlists \
&& ln -s /images/radio-stations /var/www/html/public/img/radio-stations \
&& ln -s /images/radio-stations /var/www/html/public/img/radio-stations

# Volumes for the music files 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/storage/search-indexes"]
VOLUME ["/music", "/var/www/html/storage/search-indexes", "/images"]

RUN cd /var/www/html \
&& php artisan route:cache \
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ services:
- DB_PASSWORD=password
volumes:
- music:/music
- covers:/var/www/html/public/img/covers
- images:/images
- search_index:/var/www/html/storage/search-indexes
- ./.env.koel:/var/www/html/.env
- ./sql:/docker-entrypoint-initdb.d
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- DB_DATABASE=koel
volumes:
- music:/music
- covers:/var/www/html/public/img/covers
- images:/images
- search_index:/var/www/html/storage/search-indexes
- ./sql:/docker-entrypoint-initdb.d

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ services:
- DB_DATABASE=koel
volumes:
- music:/music
- covers:/var/www/html/public/img/covers
- images:/images
- search_index:/var/www/html/storage/search-indexes

database:
Expand Down
8 changes: 8 additions & 0 deletions koel-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

set -e

echo "Creating image directories if needed..."
mkdir -p /images/artists \
&& mkdir -p /images/avatars \
&& mkdir -p /images/covers \
&& mkdir -p /images/playlists \
&& mkdir -p /images/radio-stations \
&& chown www-data:www-data /images/*

# Change to program root directory.
cd /var/www/html

Expand Down