Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

feat: Pushing example server docker container to Dockerhub #44

Conversation

wojta
Copy link
Contributor

@wojta wojta commented Feb 4, 2019

Description

https://issues.jboss.org/browse/AEROGEAR-8437
Automated publishing of aerogear/voyager-server-example-task container to Dockerhub.

Tested in my fork https://circleci.com/gh/wojta/voyager-ionic-example/9

@wojta wojta changed the base branch from development to master February 4, 2019 13:28
@wojta wojta force-pushed the AEROGEAR-8437-pushing-server-docker-container branch from 17606ac to 7b753ad Compare February 4, 2019 13:30
#!/bin/sh

#use TAG env. variable to create the container with the given tag
TAG="${TAG:-latest}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could it be both latest and actual tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It works this way - when something is published to master it makes it without tag, so it's published as latest, on release it provides the TAG.
It can happen that the latest and latest released version are not the same. I'm not sure, how to fix it.
Maybe build it only on release and make it publish both version with the tag and latest.

Copy link
Contributor

@wtrocki wtrocki Feb 4, 2019

Choose a reason for hiding this comment

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

I meant that on release should also update latest. This will fix it.

EDIT: Yes. Exactly your suggestion. That was the whole point. Always update latest, on release push additionally to tag.

server/push-script.sh Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
cd server
[ -z "$DOCKERHUB_USERNAME" ] && echo "Undefined DOCKERHUB_USERNAME, skipping publish" && exit 0;
docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD
TAG=$CIRCLE_TAG ./push-script.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can have everything above inside this script?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved

@wtrocki
Copy link
Contributor

wtrocki commented Feb 4, 2019

Small improvements suggested. It's more important if that works.
Feel free to create release from development after: 0.1.0

@wtrocki wtrocki changed the base branch from master to development February 4, 2019 14:16
@wojta
Copy link
Contributor Author

wojta commented Feb 5, 2019

Please don't merge. It's not working yet.

@wojta wojta changed the title feat: Pushing example server docker container to Dockerhub [don't merge] feat: Pushing example server docker container to Dockerhub Feb 5, 2019
CONTAINER_LATEST="$NAMESPACE/voyager-server-example-task:latest"

echo "Building docker container $CONTAINER"
docker build -f Dockerfile -t "$CONTAINER" "$WORKDIR" && docker push "$CONTAINER" && docker push "$CONTAINER_LATEST"
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO, it's much better to put these statements on their own lines. There is no need to group them together because failure in any of them will fail the build. It makes the line harder to read and during failures in CI it makes the error output more difficult to debug because you're wondering which statement failed.

Additionally, the docker push $CONTAINER_LATEST statement will likely fail here because you need to tag the image. You need to do something like docker build -f Dockerfile -t $CONTAINER -t CONTAINER_LATEST that will ensure the image is tagged with both the version tag and with latest.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is docker tag command. It will add new tag there. No need to build it again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I added it after you added your comments.

@wojta wojta force-pushed the AEROGEAR-8437-pushing-server-docker-container branch from 5707642 to 90d400f Compare February 5, 2019 10:06
@wojta wojta changed the title [don't merge] feat: Pushing example server docker container to Dockerhub feat: Pushing example server docker container to Dockerhub Feb 5, 2019
@wojta wojta force-pushed the AEROGEAR-8437-pushing-server-docker-container branch from 90d400f to 0b7c463 Compare February 5, 2019 10:13
@wojta wojta merged commit c2f92c2 into aerogear:development Feb 5, 2019
ziccardi pushed a commit to ziccardi/ionic-showcase that referenced this pull request Feb 8, 2019
* feat: pushing container for server example
* Addressing PR comments
wtrocki pushed a commit that referenced this pull request Feb 22, 2019
* feat: pushing container for server example
* Addressing PR comments
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants