Skip to content

Commit 7d3e0e9

Browse files
authored
Reduce the size of the published Docker image (alexjustesen#532)
1 parent e6d511a commit 7d3e0e9

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
/.github
33
/.idea
44
/.vscode
5-
/docker/8.1
5+
/docker/*
6+
!/docker/deploy
67
/node_modules
78
/public/build
89
/public/hot

Dockerfile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ ENV SSL_MODE="mixed"
99
# Install addition packages and cron file
1010
RUN apt-get update \
1111
&& apt-get install -y --no-install-recommends cron gnupg php8.1-gd php8.1-pgsql \
12-
&& echo "MAILTO=\"\"\n* * * * * webuser /usr/bin/php /var/www/html/artisan schedule:run" > /etc/cron.d/laravel
13-
12+
&& echo "MAILTO=\"\"\n* * * * * webuser /usr/bin/php /var/www/html/artisan schedule:run" > /etc/cron.d/laravel \
13+
\
1414
# Install Speedtest cli
15-
RUN curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash \
16-
&& apt-get install -y speedtest
17-
15+
&& curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | bash \
16+
&& apt-get install -y --no-install-recommends speedtest \
17+
\
1818
# Clean up package lists
19-
RUN apt-get clean \
19+
&& apt-get clean \
2020
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
2121

2222
# Copy package configs
@@ -28,7 +28,7 @@ WORKDIR /var/www/html
2828
COPY --chown=webuser:webgroup . /var/www/html
2929

3030
# Install app dependencies
31-
RUN composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev \
31+
RUN composer install --no-interaction --prefer-dist --optimize-autoloader --no-dev --no-cache \
3232
&& mkdir -p storage/logs \
3333
&& php artisan optimize:clear \
3434
&& chown -R webuser:webgroup /var/www/html

0 commit comments

Comments
 (0)