Skip to content

Commit

Permalink
Run farmOS Docker containers as the www-data user. Fixes farmOS#582
Browse files Browse the repository at this point in the history
  • Loading branch information
AlMaVizca authored and mstenta committed Oct 18, 2023
1 parent 0cacff7 commit 3eb94de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions docker/Dockerfile
Expand Up @@ -65,3 +65,6 @@ RUN mkdir /var/farmOS \
COPY --chown=www-data docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["apache2-foreground"]

# Run as the www-data user.
USER www-data
8 changes: 7 additions & 1 deletion docker/dev/Dockerfile
Expand Up @@ -7,6 +7,9 @@ ARG FARMOS_VERSION=2.x
ARG PROJECT_REPO=https://github.com/farmOS/composer-project.git
ARG PROJECT_VERSION=2.x

# Change to the root user for system-level changes.
USER root

# Install and enable XDebug extension.
RUN yes | pecl install xdebug \
&& docker-php-ext-enable xdebug
Expand Down Expand Up @@ -53,11 +56,14 @@ RUN cp -p /var/farmOS/web/core/phpunit.xml.dist /var/farmOS/phpunit.xml \
&& sed -i 's| </php>| <env name="SYMFONY_DEPRECATIONS_HELPER" value="quiet[]=indirect"/>'"\n"' </php>|g' /var/farmOS/phpunit.xml \
&& mkdir -p /var/farmOS/web/sites/simpletest/browser_output

# Change back to the root user.
# Change to the root user.
USER root

# Copy the farmOS codebase into /opt/drupal.
RUN rm -r /opt/drupal && cp -rp /var/farmOS /opt/drupal

# Create a Composer config directory for the www-data user.
RUN mkdir /var/www/.composer && chown www-data:www-data /var/www/.composer

# Run as the www-data user.
USER www-data

0 comments on commit 3eb94de

Please sign in to comment.