-
Notifications
You must be signed in to change notification settings - Fork 413
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Dockerfile to use multi-stage builds (#2004)
Refactored Dockerfile to use multi-stage builds for reduction image size. The installation of the packages required for the build and the build process are carried out at the build stage. The built binaries are then placed in the final image. This changes has reduces the image size about 1/3. ``` $ docker image ls apache/age REPOSITORY TAG IMAGE ID CREATED SIZE apache/age tmp 5ffd0b539a88 22 minutes ago 458MB <-- New image apache/age latest fb44b5789198 2 months ago 1.5GB <-- Original image ```
- Loading branch information
Showing
2 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
|
||
docker buildx create --name multiarch --use --platform linux/amd64,linux/arm64/v8 | ||
docker buildx build ../ -t $IMAGE_NAME -f Dockerfile --platform linux/amd64,linux/arm64/v8 --push | ||
docker buildx create --name multiarch --use --platform linux/amd64 | ||
docker buildx build ../ -t shinya11kato/age:pg15 -f Dockerfile --platform linux/amd64 --push --no-cache |