-
-
Notifications
You must be signed in to change notification settings - Fork 132
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
refactor: Optimize dockerfiles for production images #4302
Conversation
This looks great. Nice trick on the multistage images, we wrote them long time ago when this wasn't available, it's great to see it used now. |
876a911
to
69400c9
Compare
Where should containers be pushed to? - name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
if: needs.build_details.outputs.publish_docker_image == 'true'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} - name: Login to container registries
run: |
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USER }}" --password-stdin
echo "${{ secrets.GITHUB_TOKEN }}" | docker login -u "${{ github.actor }}" --password-stdin ghcr.io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Head branch was pushed to by a user without write access
b2c29f9
to
9b987be
Compare
9b987be
to
880b42e
Compare
Create a separate stage to download files and mount it as a volume later. Remove tini as it's not needed to run liquidsoap as main process. Use RUN syntax similar to that used for official images. Remove apt lists from the resulting Debian container images.
Replace the build-docker.sh script with a GitHub action to standardize the ci workflow and reduce complexity.
880b42e
to
6204a1e
Compare
@toots, |
Summary
This PR improves the Dockerfiles by creating smaller production images.
Details
ADD
,COPY
, and download files.tini
process manager because it is unnecessary to run Liquidsoap as the main process. Also, some Debian dependencies, such asexim
, are not installed due to--no-install-recommends
.RUN
syntax that matches official images, making the Dockerfiles easier to read and understand.Additionally
Size difference:
savonet/liquidsoap-alpine:rolling-release-v2.3.x
: from 295MB to 278MBsavonet/liquidsoap:rolling-release-v2.3.x
: from 795MB to 697MBRefactored GitHub actions workflow to use docker/login-action and docker/build-push-action instead of
docker login
andbuild-docker.sh
.Renamed Dockerfiles:
Dockerfile.production
todebian.dockerfile
;Dockerfile.alpine-production
toalpine.dockerfile
;Dockerfile.website
towebsite.dockerfile
.The list of packages removed from the debian-based image