Skip to content

Commit 4be8ffe

Browse files
authored
Docker image size reduced (#1540)
* try to reduce the image size * revert moving of composer install as it's later missing and we only would save 2MB * fixed install command
1 parent c5fd68f commit 4be8ffe

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

Dockerfile

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,21 @@ RUN apt-get update \
4040
&& apt-get -y install mariadb-client \
4141
&& apt-get -y install libpng-dev \
4242
&& apt-get -y install ssmtp \
43-
\
43+
\
4444
# Install extensions (optional)
4545
&& docker-php-ext-install pdo_mysql gd \
46-
\
47-
# Install composer
46+
\
47+
# Install Composer
4848
&& curl -sS https://getcomposer.org/installer | php \
4949
&& mv composer.phar /usr/local/bin/composer \
5050
# Enable URL rewriting using .htaccess
5151
&& a2enmod rewrite \
5252
# Enable headers
53-
&& a2enmod headers
53+
&& a2enmod headers \
54+
# Clean Up
55+
&& apt-get autoremove -y \
56+
&& apt-get clean -y \
57+
&& rm -rf /var/lib/apt/lists/*
5458

5559
RUN sed -i 's/KeepAliveTimeout 5/KeepAliveTimeout 10/' /etc/apache2/apache2.conf
5660
RUN echo "ServerTokens Prod" >> /etc/apache2/apache2.conf \
@@ -80,6 +84,7 @@ RUN mkdir -p ${HASHTOPOLIS_DOCUMENT_ROOT} \
8084

8185
COPY --from=preprocess /HEA[D] ${HASHTOPOLIS_DOCUMENT_ROOT}/../.git/
8286

87+
# Install composer
8388
COPY composer.json ${HASHTOPOLIS_DOCUMENT_ROOT}/../
8489
RUN composer install --working-dir=${HASHTOPOLIS_DOCUMENT_ROOT}/..
8590

@@ -122,12 +127,6 @@ RUN apt-get update \
122127
#TODO: Should source from ./ci/apiv2/requirements.txt
123128
RUN pip3 install click click_log confidence pytest tuspy --break-system-packages
124129

125-
# Clean up
126-
RUN apt-get autoremove -y \
127-
&& apt-get clean -y \
128-
&& rm -rf /var/lib/apt/lists/*
129-
130-
131130
# Adding VSCode user and fixing permissions
132131
RUN groupadd vscode && useradd -rm -d /var/www -s /bin/bash -g vscode -G www-data -u 1001 vscode \
133132
&& chown -R vscode:www-data /var/www \
@@ -154,12 +153,7 @@ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
154153
&& touch "/usr/local/etc/php/conf.d/custom.ini" \
155154
&& echo "memory_limit = 256m" >> /usr/local/etc/php/conf.d/custom.ini \
156155
&& echo "upload_max_filesize = 256m" >> /usr/local/etc/php/conf.d/custom.ini \
157-
&& echo "max_execution_time = 60" >> /usr/local/etc/php/conf.d/custom.ini \
158-
\
159-
# Clean up
160-
&& apt-get autoremove -y \
161-
&& apt-get clean -y \
162-
&& rm -rf /var/lib/apt/lists/*
156+
&& echo "max_execution_time = 60" >> /usr/local/etc/php/conf.d/custom.ini
163157

164158
USER www-data
165159
# ----END----

0 commit comments

Comments
 (0)