Skip to content

Commit

Permalink
Release 21.08
Browse files Browse the repository at this point in the history
  • Loading branch information
accetto committed Aug 7, 2021
1 parent 53c570e commit adf5015
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@

.vscode
.developer*
.secret*
*.log
avanti*
debug*
scrap*
secret*
TODO*
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@

***

### Release 21.08

- Docker Hub has removed auto-builds from free plans since 2021-07-26, therefore
- **if you stay on the free plan**, then
- you can still build the images locally and then push them to Docker Hub
- pushing to Docker Hub is optional
- just follow the added file `local-building-example.md`
- you can use the helper utility `builder.sh`
- regularity of updates of images on Docker Hub cannot be guaranteed any more

### Release 21.04

- TigerVNC from [Release Mirror on accetto/tigervnc][accetto-tigervnc-release-mirror] because **Bintray** is closing on 2021-05-01
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ./hooks/build dev
# ./hooks/test dev
# ./hooks/build latest
# ./hooks/test latest

### Example: Build and test 'dev' tag locally like
### ./hooks/build dev
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ The image is regularly maintained and rebuilt. The history of notable changes is
- `latest` based on `ubuntu:latest`

![badge-VERSION_STICKER_LATEST][badge-VERSION_STICKER_LATEST]
![badge-github-commit-latest][badge-github-commit-latest]

### Ports

Expand Down Expand Up @@ -321,5 +320,3 @@ Credit also goes to all the countless people and companies who contribute to ope
<!-- latest tag badges -->

[badge-VERSION_STICKER_LATEST]: https://badgen.net/badge/version%20sticker/ubuntu18.04.5/blue

[badge-github-commit-latest]: https://images.microbadger.com/badges/commit/accetto/ubuntu-vnc-xfce.svg
105 changes: 105 additions & 0 deletions builder.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/bin/bash
### @accetto, August 2021

docker_hub_connect() {

if [ -n "${DOCKERHUB_USERNAME}" ] && [ -n "${DOCKERHUB_PASSWORD}" ] ; then

echo "Logging-in on Docker Hub..."
echo "${DOCKERHUB_PASSWORD}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin
if [ ! $? ] ; then
echo "Docker Hub login failed"
return 1
fi
else
echo "Local pushing requires Docker Hub login."
echo "However, your environment does not provide required authentication data."
return 1
fi

return 0
}

main() {

local tag=${1?Need tag}
local cmd=${2?Need command}

local result

case "${cmd}" in

build | test )

./hooks/"${cmd}" "${tag}"
;;

push )

docker_hub_connect

if [ $? -eq 0 ] ; then

### push to Docker Hub
./hooks/"${cmd}" "${tag}"

docker logout

else

echo "Unable to connect to Docker hub!"
fi
;;

all )

echo
echo "------------------"
echo "--> Building image"
echo "------------------"
echo

./hooks/build "${tag}"

echo
echo "---------------------------"
echo "--> Testing version sticker"
echo "---------------------------"
echo

### test version sticker
result=$( hooks/test "${tag}" 2>&1 | tail -n1 )

if [ "${result}" == '+ exit 0' ] ; then

docker_hub_connect

if [ $? -eq 0 ] ; then

echo
echo "-------------------------"
echo "--> Pushing to Docker Hub"
echo "-------------------------"
echo

hooks/push "${tag}"

docker logout

else

echo "Unable to connect to Docker hub!"
fi

else
echo "Version sticker has changed. Adjust 'env' hook and refresh README using 'util-refresh-readme.sh'. Use 'test' command for details."
fi
;;

*)
echo "Unknown command: ${cmd}"
;;
esac
}

main $@
86 changes: 86 additions & 0 deletions local-building-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Local building example

- [Local building example](#local-building-example)
- [Preparation](#preparation)
- [Building pipeline](#building-pipeline)
- [Step 1: `build`](#step-1-build)
- [Step 2: `test`](#step-2-test)
- [Step 3: `push`](#step-3-push)
- [All steps at once](#all-steps-at-once)

Docker Hub has removed auto-building from free plans since 2021-07-26.

This page describes how to build the image locally and optionally push it to Docker Hub.

If you just want to build the image locally without publishing it on Docker Hub, then you can use the `one-liners` shown at the top of the Dockerfile.

There is a helper utility `builder.sh`, which supports executing the whole building pipeline locally, including pushing the image to Docker Hub.

## Preparation

Open a terminal windows and change the current directory to the root of the project (where the license file is).

There is an example secrets file in the `utils` subdirectory of the project. Copy and modify it and then source it in the terminal:

```bash
### make a copy and then modify it
cp utils/example-secrets.rc secrets.rc

### source the secrets
source ./secrets.rc
```

## Building pipeline

The full building pipeline consists of the following four hook scripts and one utility script:

- `build`
- `test`
- `push`
- `util-refresh-readme.sh`

The order of executing the scripts is important.

The commands in the following example would build and publish the image `accetto/ubuntu-vnc-xfce:latest`.

The helper utility `builder.sh` will be used. Alternatively you can also use the hook scripts directly.

### Step 1: `build`

```bash
./builder.sh latest build
```

This command builds a new local image.

### Step 2: `test`

```bash
./builder.sh latest test
```

This command checks if the version sticker has changed. This step is optional and you can skip it if you are not interested in the version sticker value.

Otherwise, if the version sticker has changed since the last project update, then adjust the version sticker variables in the `env` hook script and repeat the steps 1 and 2.

Also update the `README` file using the helper utility `util-refresh-readme.sh`.

### Step 3: `push`

```bash
./builder.sh latest push
```

This command will push the new image to Docker Hub.

Note that currently you have to update the `README` file on Docker Hub yourself. You can do it in edit mode by simple copy-and-paste from the local file, which you've already updated by the helper utility described above.

### All steps at once

Alternatively you can execute the whole building pipeline using the `all` command:

```bash
./builder.sh latest all
```

Note that this command doesn't update the `README` file. You still have to do it yourself using the helper utility described above.
11 changes: 11 additions & 0 deletions utils/example-secrets.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### This files configures the environment (including secrets!) for the local builder utility (builder.sh).
### You should source this file yourself before using the local builder utility.
### Rename the file to "secrets.rc" (or similar) and **make sure** that the '.gitignore' and '.dockerignore' files
### contain the 'secret*' exclusion pattern!

### Required only for publishing README on Docker Hub.
### These values can be also provided or overriden through the utility input arguments.
### !!! REAL SECRETS !!!
### warning! this credentials are valid for all Docker Hub repositories of the same owner!
export DOCKERHUB_USERNAME="xxxxxx"
export DOCKERHUB_PASSWORD="xxxxxx"

0 comments on commit adf5015

Please sign in to comment.