Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #8884: Fixed alpine image build #8885

Merged
merged 5 commits into from
Dec 15, 2020

Conversation

PauloLuna
Copy link
Contributor

Description

The Alpine docker image build was broken. This PR aims to reestablish this build so that it is possible to use a reduced size Docker image and based on a distribution focused on security

Fixes #8884

Type of change

  • [*] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

The image was built and deployed in a complete production environment

Test Configuration:

  • PHP version: 7
  • MySQL version: 8.0.22
  • Webserver version: Apache/2.4.46
  • OS version: Alpine 3.12

Checklist:

@welcome
Copy link

welcome bot commented Dec 10, 2020

💖 Thanks for this pull request! 💖

We use semantic commit messages to streamline the release process and easily generate changelogs between versions. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix if it doesn't have one already.

Examples of commit messages with semantic prefixes:

  • Fixed #<issue number>: don't overwrite prevent_default if default wasn't prevented
  • Added #<issue number>: add checkout functionality to assets
  • Improved Asset Checkout: use new notification method for checkout

Things that will help get your PR across the finish line:

  • Document any user-facing changes you've made.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thank you for the fix! I had a few small questions I wanted to make sure I understood before I merge your PR though - once you can answer those, I'll make sure to get this merged and released! In the meantime, I'm going to try to do a docker build against this PR and see if it gets any further than the previous one.

@@ -23,6 +23,8 @@ RUN apk add --update --no-cache \
php7-fileinfo \
php7-simplexml \
php7-session \
php7-dom \
php7-xmlwriter \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just confirmed; the current Alpine Dockerfile does break during composer install because of the lack of these two packages.

@@ -45,7 +47,8 @@ WORKDIR /var/www/html

COPY docker/docker.env /var/www/html/.env

RUN chown -R apache:apache /var/www/html
RUN mkdir -p "/var/www/html/vendor" \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The existing Alpine Dockerfile doesn't do this, and Composer seems to still work OK. Is your thinking here that we want to pre-create the directory so the following chown will make the ./vendor directory owned by Apache? Or is there some other reason?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, while I was making the changes the composer presented a permission error when trying to change this folder, but apparently it was a storage problem in the Docker VM. I did a rebuild without this change and it worked fine. I will make a commit correcting this.

@@ -49,5 +49,7 @@ php artisan migrate --force
php artisan config:clear
php artisan config:cache

chown -R apache:root /var/www/html/storage/logs/laravel.log
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this must just be another permissions bug we're fixing - but this wasn't here before so I just want to make sure...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this line because after a forced reboot of the container, the ownership of this file was transferred to the root user, preventing a new initialization. In a normal startup this line is not necessary

Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely better than what we have already - I'm still a little curious why the additional changes are there, but they definitely seem innocuous enough that I'm going to approve it and get it to our Alpine users.

@snipe snipe merged commit e410696 into snipe:develop Dec 15, 2020
@welcome
Copy link

welcome bot commented Dec 15, 2020

Congrats on merging your first pull request! 🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants