Skip to content

Commit

Permalink
[Docker] Removed auth.json from images
Browse files Browse the repository at this point in the history
  • Loading branch information
vidarl committed Sep 14, 2017
1 parent 8ded060 commit 55be337
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
@@ -1,6 +1,9 @@
### IDE files
.idea/

### Composer files
auth.json

### GIT files
.git
vendor/*/*/.git
Expand Down
11 changes: 5 additions & 6 deletions Dockerfile
@@ -1,8 +1,5 @@
FROM ezsystems/php:7.0-v1

# Build argument about keeping auth.json or not (by default on as prod images should'nt get updates via composer update)
ARG REMOVE_AUTH=1

# This is prod image (for dev use just mount your application as host volume into php image we extend here)
ENV SYMFONY_ENV=prod

Expand All @@ -14,13 +11,15 @@ RUN if [ -d .git ]; then echo "ERROR: .dockerignore folders detected, exiting" &

# Install and prepare install
RUN mkdir -p web/var \
&& composer install --optimize-autoloader --no-progress --no-interaction --no-suggest --prefer-dist \
# For now, only run composer in order to generate parameters.yml
&& composer run-script post-install-cmd --no-interaction \
&& composer dump-autoload --optimize \
# Clear cache again so env variables are taken into account on startup
&& rm -Rf app/logs/* app/cache/*/* \
# Fix permissions for www-data
&& chown -R www-data:www-data app/cache app/logs web/var \
&& find app/cache app/logs web/var -type d -print0 | xargs -0 chmod -R 775 \
&& find app/cache app/logs web/var -type f -print0 | xargs -0 chmod -R 664 \
# Remove composer cache to avoid it taking space in image
&& rm -rf ~/.composer/*/* \
&& [ "$REMOVE_AUTH" = "1" ] && rm -f auth.json
&& rm -rf ~/.composer/*/*

0 comments on commit 55be337

Please sign in to comment.