Skip to content

Commit 7a03e88

Browse files
authored
Refactor Dockerile (#245)
1 parent 5943b8c commit 7a03e88

File tree

3 files changed

+35
-24
lines changed

3 files changed

+35
-24
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@
2626
**.editorconfig
2727
**.gitattributes
2828
**.gitignore
29+
**.md

infra/docker/mysql/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ FROM mysql/mysql-server:8.0
22

33
ENV TZ=UTC
44

5-
RUN mkdir /var/log/mysql \
6-
&& chown mysql:mysql $_ \
7-
&& chmod 777 $_
5+
RUN <<EOF
6+
mkdir /var/log/mysql
7+
chown mysql:mysql $_
8+
chmod 777 $_
9+
EOF

infra/docker/php/Dockerfile

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,43 @@ ENV TZ=UTC \
1414

1515
COPY --from=composer:2.6 /usr/bin/composer /usr/bin/composer
1616

17-
RUN apt-get update \
18-
&& apt-get -y install --no-install-recommends \
17+
RUN <<EOF
18+
apt-get update
19+
apt-get -y install --no-install-recommends \
1920
locales \
2021
git \
2122
unzip \
2223
libzip-dev \
2324
libicu-dev \
24-
libonig-dev \
25-
&& locale-gen en_US.UTF-8 \
26-
&& localedef -f UTF-8 -i en_US en_US.UTF-8 \
27-
&& docker-php-ext-install \
25+
libonig-dev
26+
locale-gen en_US.UTF-8
27+
localedef -f UTF-8 -i en_US en_US.UTF-8
28+
docker-php-ext-install \
2829
intl \
2930
pdo_mysql \
3031
zip \
31-
bcmath \
32-
&& composer config -g process-timeout 3600 \
33-
&& composer config -g repos.packagist composer https://packagist.org
32+
bcmath
33+
composer config -g process-timeout 3600
34+
composer config -g repos.packagist composer https://packagist.org
35+
EOF
3436

3537
FROM base AS development
3638

37-
RUN apt-get -y install --no-install-recommends \
38-
default-mysql-client \
39-
&& apt-get clean \
40-
&& rm -rf /var/lib/apt/lists/*
39+
RUN <<EOF
40+
apt-get -y install --no-install-recommends \
41+
default-mysql-client
42+
apt-get clean
43+
rm -rf /var/lib/apt/lists/*
44+
EOF
4145

4246
COPY ./infra/docker/php/php.development.ini /usr/local/etc/php/php.ini
4347

4448
FROM development AS development-xdebug
4549

46-
RUN pecl install xdebug \
47-
&& docker-php-ext-enable xdebug
50+
RUN <<EOF
51+
pecl install xdebug
52+
docker-php-ext-enable xdebug
53+
EOF
4854

4955
COPY ./infra/docker/php/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
5056

@@ -53,9 +59,11 @@ FROM base AS deploy
5359
COPY ./infra/docker/php/php.deploy.ini /usr/local/etc/php/php.ini
5460
COPY ./src /workspace
5561

56-
RUN composer install -q -n --no-ansi --no-dev --no-scripts --no-progress --prefer-dist \
57-
&& chmod -R 777 storage bootstrap/cache \
58-
&& php artisan optimize:clear \
59-
&& php artisan optimize \
60-
&& apt-get clean \
61-
&& rm -rf /var/lib/apt/lists/*
62+
RUN <<EOF
63+
composer install -q -n --no-ansi --no-dev --no-scripts --no-progress --prefer-dist
64+
chmod -R 777 storage bootstrap/cache
65+
php artisan optimize:clear
66+
php artisan optimize
67+
apt-get clean
68+
rm -rf /var/lib/apt/lists/*
69+
EOF

0 commit comments

Comments
 (0)