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

Add a command hook to cleanup built images #534

Merged
merged 4 commits into from
Jan 22, 2021

Conversation

andytson-inviqa
Copy link
Contributor

Replacing potential for discrepancy of deleting images based on matching hardcoding

@andytson-inviqa andytson-inviqa added the enhancement New feature or request label Jan 21, 2021
@andytson-inviqa andytson-inviqa added this to the 1.0.0 milestone Jan 21, 2021
@kierenevans
Copy link
Contributor

Okay to include #515 additions?

@andytson-inviqa
Copy link
Contributor Author

can you tell me why they wouldn't be covered by this? (maybe in slack as it'll be a bit of discussion)

@kierenevans
Copy link
Contributor

Though it might do already actually!

Sorry for the build failure, trying to replace jenkins workers and had to cancel it

Replacing potential for discrepancy of deleting images based on matching hardcoding
@andytson-inviqa andytson-inviqa force-pushed the feature/cleanup-built-images branch from 53f098d to 39dd1e2 Compare January 21, 2021 17:39
@andytson-inviqa andytson-inviqa force-pushed the feature/cleanup-built-images branch from 0c9bcf1 to b1908f9 Compare January 21, 2021 17:55
@kierenevans
Copy link
Contributor

Testing this locally with ./build && ./test php static, I'm left with a 922MB image:

docker image ls | head -n30
REPOSITORY                            TAG                        IMAGE ID       CREATED         SIZE
<none>                                <none>                     49581cfebaeb   2 minutes ago   922MB

Seems to be due to the multi-stage build for php-fpm from console:

> docker-compose build php-fpm
Building php-fpm
Step 1/13 : FROM ci-php-sample-static:b1908f9e057628fc039b085c6ee94d9b659a5dfb-console as console
 ---> 91b3f0326547
Step 2/13 : RUN if [ -d /app/tools/assets/ ]; then rm -rf /app/tools/assets/; fi
 ---> Running in aad57c2336b5
Removing intermediate container aad57c2336b5
 ---> 442cfdabf896
Step 3/13 : RUN if [ -d /app/node_modules/ ]; then rm -rf /app/node_modules/; fi
 ---> Running in 3cd1e964ed86
Removing intermediate container 3cd1e964ed86
 ---> 49581cfebaeb

Step 4/13 : FROM my127/php:8.0-fpm-buster
 ---> af838a7410dc
Step 5/13 : WORKDIR /app
 ---> Running in 18b4e8e15196
Removing intermediate container 18b4e8e15196
 ---> e07650a89137

@andytson-inviqa
Copy link
Contributor Author

andytson-inviqa commented Jan 21, 2021

that's why I'm thinking docker image prune in CI, either here or a regular cron. Can also alternatively label the image to delete it by filter, but would need to remember that practice for any other multi-stage build (which may not even be FROM a project's image)

In cases where docker image prune or --filter=since would have minor adverse effects on other projects, so it can even be run in local environments
@andytson-inviqa andytson-inviqa force-pushed the feature/cleanup-built-images branch from bf843bc to 4a8ed54 Compare January 21, 2021 18:59
@kierenevans kierenevans merged commit c294eae into 1.0.x Jan 22, 2021
@kierenevans kierenevans deleted the feature/cleanup-built-images branch January 22, 2021 09:08
@kierenevans kierenevans added the harness-php PHP harness label Jan 22, 2021
kierenevans added a commit to inviqa/harness-go that referenced this pull request Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request harness-php PHP harness
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants