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

Install Composer dependencies for Docker + add .dockerignore #1162

Merged
merged 3 commits into from
May 20, 2021

Conversation

osma
Copy link
Member

@osma osma commented May 20, 2021

This PR contains the changes from @jrvosse's PR #1157, i.e. Composer dependencies are now installed within the Docker container.

I'm still a bit nervous about the interaction between changes done on source tree and the Docker image. I thought it would be better to have a cleaner separation between them - for example, whatever is (or isn't) done with Composer on the original source tree shouldn't affect how Composer packages are installed within the container.

So in an additional commit, I created a simple .dockerfile (based on .gitignore) that omits the following files and directories when copying files inside the Docker container:

config.ttl
build
vendor
report
components
plugins/*
composer.phar
composer.lock
tests/jena-fuseki*
.vagrant
.project
.DS_Store
.phpunit.result.cache

Not sure if this is the exact set we want but I think this is a good starting point, and it seems to work. These are files and directories that are not under version control anyway, and with Composer running inside the container, building a Docker image from a fresh git clone-d source tree already works (I just tested it), so I don't think there should be any danger in excluding these files. As a bonus, potentially large files such as Fuseki installations used by the test suite are excluded from the Docker image as well.

Comments @jrvosse @kinow ?

@osma osma added the bug label May 20, 2021
@osma osma added this to the 2.11 milestone May 20, 2021
@codecov
Copy link

codecov bot commented May 20, 2021

Codecov Report

Merging #1162 (a6c8837) into master (4a050f4) will not change coverage.
The diff coverage is n/a.

❗ Current head a6c8837 differs from pull request most recent head 046169b. Consider uploading reports for the commit 046169b to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1162   +/-   ##
=========================================
  Coverage     67.97%   67.97%           
  Complexity     1584     1584           
=========================================
  Files            32       32           
  Lines          3888     3888           
=========================================
  Hits           2643     2643           
  Misses         1245     1245           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a050f4...046169b. Read the comment docs.

Copy link
Collaborator

@kinow kinow left a comment

Choose a reason for hiding this comment

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

👍 completely forgot about the .dockerignore, sorry @osma.

It doesn't hurt to add a few extra files for just-in-case too, if you'd like. Last one I remember writing I added .git, .ssh, and other files that were not supposed to be included in the Docker build context.

@sonarcloud
Copy link

sonarcloud bot commented May 20, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@osma
Copy link
Member Author

osma commented May 20, 2021

Thanks for the tips @kinow, I added .git as well which makes a lot of sense and should make the Docker image a lot smaller. I can't think of why .ssh would be there in the source tree in the first place, and the others in your example file were at least for the most part related to Python tooling, so probably not relevant for a PHP project.

I think I'll merge this with this set. We can always add more entries to .dockerignore later if necessary.

@osma osma merged commit 4b538db into master May 20, 2021
@osma osma deleted the odissei-data-master branch May 20, 2021 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants