Changeset View
Standalone View
docker/build_image.sh
- This file was added.
Property | Old Value | New Value |
---|---|---|
File Mode | null | 100755 |
#!/usr/bin/env bash | |||||
# Use: ./build_image.sh: If not logged in in docker hub, this will build the image. If | |||||
# logged in, this will also push the image to the softwareheritage organization | |||||
# repository (unless PUBLISH variable is set to no) | |||||
vsellier: Doesn't seems to match the real behavior of the script
(not pushing by default as implemented… | |||||
ardumontAuthorUnsubmitted Done Inline Actionsright, better formulation: # Use: ./build_image.sh: Build the image. If the user is logged in and PUBLISH variable # environment is set to yes, the image is also pushed in docker repository. sounds good? ardumont: right, better formulation:
```
# Use: ./build_image.sh: Build the image. If the user is logged… | |||||
set -x | |||||
builddate=$(date +%Y%m%d) | |||||
buildtime=$(date +%H%M%S) | |||||
builddatetime="${builddate}-${buildtime}" | |||||
username=$(docker info 2>&1 | grep Username | awk '{print $2}') | |||||
img=softwareheritage/maven-index-exporter | |||||
docker build \ | |||||
vsellierUnsubmitted Not Done Inline ActionsAnother thought, the --pull option allows to refresh the base image if a new version is available. vsellier: Another thought, the --pull option allows to refresh the base image if a new version is… | |||||
--file Dockerfile \ | |||||
--tag ${img}:${builddatetime} \ | |||||
. | |||||
docker tag ${img}:${builddatetime} ${img}:${builddate} | |||||
docker tag ${img}:${builddate} ${img}:latest | |||||
if [[ -n "${username}" ]] && [[ "${PUBLISH:=no}" = "yes" ]]; then | |||||
echo "Publishing image softwareheritage:${img}-${builddate} on docker hub" | |||||
docker push softwareheritage/${img}:${builddatetime} | |||||
docker push softwareheritage/${img}:${builddate} | |||||
docker push softwareheritage/${img}:latest | |||||
fi | |||||
vsellierUnsubmitted Not Done Inline ActionsDo we really need all these images on docker hub? The pushed images should be related to a tag in the git repository to know what the image contains or we will never know which version is running on the servers . We should build the latest by default and support a way to override the tag name to something specific when needed vsellier: Do we really need all these images on docker hub?
The pushed images should be related to a tag… | |||||
ardumontAuthorUnsubmitted Done Inline Actionsno idea, i just copied everything from there. Will see what i can about it. ardumont: no idea, i just copied everything from there.
Agreed that the a git tag sounds better!
Will… | |||||
douarddaUnsubmitted Not Done Inline Actions
For swh-docker, the git repository tells you nothing about the content of the image, which content will only depend on the date it has been build (since we do not have pinned versions anywhere). I would have loved to be able to store the list of swh package version installed in an image as a set of labels on that image, but I failed to find a simple method to do so (aka add labels from the dockerfile which values are the result of the execution of a command in the dockerfile). There is an issue on the similar idea on gh for years (which I cannot find right now), but it has never been implemented (might be tricky to do so). For this image, it makes more sense since it's just a matter of installing a few jar (if I get this right).
What "Latest" refers to actually here? douardda: > Do we really need all these images on docker hub?
>
> The pushed images should be related to… | |||||
echo "Done creating images." |
Doesn't seems to match the real behavior of the script
(not pushing by default as implemented seems to be a better default ;))