Skip to content

Commit 79282b0

Browse files
committed
Fix usermod
1 parent ad298f7 commit 79282b0

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

Dockerfile

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,12 @@ ENV SESSION_HANDLER=false
1111
ENV SESSION_HANDLER_NAME=""
1212
ENV SESSION_HANDLER_PATH=""
1313

14-
COPY configs/ports.conf /etc/apache2/ports.conf
15-
COPY apache-run.sh /usr/bin/apache-run
16-
17-
RUN chmod a+x /usr/bin/apache-run
18-
19-
# Install libs
2014
RUN apt-get update && apt-get install -y wget vim supervisor zip libfreetype6-dev libjpeg62-turbo-dev \
2115
libmcrypt-dev libpng-dev libssl-dev libaio1 git libcurl4-openssl-dev libxslt-dev \
2216
libldap2-dev libicu-dev libc-client-dev libkrb5-dev libsqlite3-dev libedit-dev
2317

2418
RUN a2enmod rewrite
2519

26-
# Install PHP extensions
2720
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
2821
&& docker-php-ext-configure hash --with-mhash \
2922
&& docker-php-ext-configure ldap --with-libdir=lib/x86_64-linux-gnu/ \
@@ -33,7 +26,6 @@ RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-di
3326
hash xsl ldap intl imap pdo_sqlite mbstring \
3427
mcrypt pcntl readline shmop soap sockets wddx zip
3528

36-
# Install redis
3729
RUN pecl install redis \
3830
&& echo "extension=redis.so" >> /usr/local/etc/php/conf.d/redis.ini
3931

@@ -49,16 +41,26 @@ RUN echo "---> Adding Support for NewRelic" && \
4941
cp ./scripts/newrelic.ini.template /scripts/newrelic.ini && \
5042
mkdir /var/log/newrelic
5143

52-
# Install Composer
44+
RUN echo "---> Adding the runner user" && \
45+
adduser --disabled-password -u 1000 runner && \
46+
mkdir -p /var/www/html && \
47+
chown -R runner:runner /var/www/html && \
48+
wget -O /tini https://github.com/krallin/tini/releases/download/v0.16.1/tini-static && \
49+
chmod +x /tini
50+
5351
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin/ --filename=composer
5452

55-
# Install XDebug
5653
RUN pecl install xdebug
5754

58-
USER www-data
55+
COPY configs/ports.conf /etc/apache2/ports.conf
56+
COPY apache-run.sh /usr/bin/apache-run
5957

60-
# Run composer install
58+
RUN chmod a+x /usr/bin/apache-run
6159

62-
ENTRYPOINT ["/usr/bin/apache-run"]
60+
USER runner
61+
62+
WORKDIR "/var/www/html"
6363

6464
EXPOSE 8080 9001
65+
66+
ENTRYPOINT ["/tini", "--", "/usr/bin/apache-run"]

apache-run.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ if [[ $SESSION_HANDLER == true ]]; then
1616
echo "session.save_path = $SESSION_HANDLER_PATH" >> /usr/local/etc/php/conf.d/session-handler.ini
1717
fi
1818

19-
usermod -u 1000 www-data \
20-
&& cd /var/www/html && composer install && rm -rf var/cache/* var/logs/* \
19+
composer install && rm -rf var/cache/* var/logs/* \
2120
&& mkdir -p /var/www/html/var/cache \
2221
&& mkdir -p /var/www/html/var/logs \
2322
&& mkdir -p /var/www/html/var/sessions \

0 commit comments

Comments
 (0)