Commit d72309ce427b1dab99a0d43eb27e1845a8be1932
1 parent
6b0c5116d8
Exists in
master
and in
4 other branches
Revert "Run as root"
This reverts commit f54d74b76e3407e925459ce7aaa2ae473480fb1a.
Showing 1 changed file with 9 additions and 2 deletions
api/Dockerfile
View file @
d72309c
... | ... | @@ -32,14 +32,21 @@ |
32 | 32 | # Install composer |
33 | 33 | RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer |
34 | 34 | |
35 | -# Copy existing application directory contents | |
36 | -COPY . /var/www | |
35 | +# Add user for laravel application | |
36 | +RUN groupadd -g 1000 www && \ | |
37 | + useradd -u 1000 -ms /bin/bash -g www www | |
37 | 38 | |
39 | +# Copy existing application directory contents with correct permissions | |
40 | +COPY --chown=1000:1000 . /var/www | |
41 | + | |
38 | 42 | # Copy PHP configuration |
39 | 43 | COPY ./php/local.ini /usr/local/etc/php/conf.d/local.ini |
40 | 44 | |
41 | 45 | # Use composer to install dependencies |
42 | 46 | RUN composer install |
47 | + | |
48 | +# Change current user to www | |
49 | +USER www | |
43 | 50 | |
44 | 51 | # Expose port 9000 and start php-fpm server |
45 | 52 | EXPOSE 9000 |