Ubuntu base docker image for build tcl packages

Table of Contents
Login

Table of Contents

About

This is ubuntu base docker image (version 22.04) using s6-overlay for buid tcl software. The basic idea was taken from tcl2020-build .

Tcl-build is self-hosting at https://chiselapp.com/user/oupfiz5/repository/tcl-build.

If you are reading this on GitHub, then you are looking at a Git mirror of the self-hosting tcl-build repository. The purpose of that mirror is to test and exercise Fossil's ability to export a Git mirror and using Github CI/CD (Github Actions). Nobody much uses the GitHub mirror, except to verify that the mirror logic works. If you want to know more about tcl-build, visit the official self-hosting site linked above.

Prerequisite

Tools

  1. *nix operation system
  2. Install Docker
  3. Install git (optional)
  4. Install fossil (optional)

Third party tools

They are using for testing and scanning:

  1. BATS
  2. Shellcheck
  3. Hadolynt
  4. Dockle
  5. Snyk (todo)
  6. Trivy (todo)

Installation

Download from dockerhub

docker pull oupfiz5/tcl-build:latest
docker pull oupfiz5/tcl-build:23.05

Build from chiselapp (fossil)

fossil clone https://chiselapp.com/user/oupfiz5/repository/tcl-build tcl-build.fossil
mkdir tcl-build
cd tcl-build
fossil open ../tcl-build.fossil
docker build -t oupfiz5/tcl-build .

Build from github

git clone https://github.com/oupfiz5/tcl-build.git
cd tcl-build
docker build -t oupfiz5/tcl-build .

Configuration

Build arguments

Arguments Default Description
BUILD_DATE none Set build date for label
FOSSIL_VERSION 2.21 Set upload fossil version
VERSION none Set version for label

Example of build

docker build \
       --build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
       --build-arg VERSION='23.05' \
       --build-arg FOSSIL_VERSION='2.21' \
       --tag oupfiz5/tcl-build:23.05 \
       --file ./Dockerfile \
        .

Configuration options

For configuration is using environment variables.

General options

Option Default Description
TZ UTC Set timezone, example Europe/Moscow

Timezone

Set the timezone for the container, defaults to UTC. To set the timezone set the desired timezone with the variable TZ.

mkdir -p $(pwd)/workspaces
docker run -itd \
    -v $(pwd)/workspaces:/workspaces\
    -v $(pwd)/builds:/builds \
    --env 'TZ=Europe/Moscow' \
    --name=tcl-build \
    oupfiz5/tcl-build:23.05

Applications

The docker support builds for the following applications:

Configuration

For configuration is using docker environment variable and/or builds/env-vars.sh

Option Default Description
PREFIX /usr Default values for prefix
NS_VERSION 4.99.24 Define NaviServer version
NS_MODULES_VERSION 4.99.24 Define NaviServer modules version
RL_JSON_VERSION 0.12.2 Define RL_JSON version
TCL_VERSION 8.6.13 Define tcl version
TCLLIB_VERSION 1.20 Define tcl lib version
TDOM_VERSION 0.9.1 Define tdom version
XOTCL_VERSION 2.4.0 Define xotcl version

Usage

Builder

Run the build container in the background with Docker:

mkdir -p $(pwd)/workspaces
docker run -itd \
    -v $(pwd)/workspaces:/workspaces \
    -v $(pwd)/builds:/builds \
    --name=tcl-build \
    oupfiz5/tcl-build:23.05

Build applications

Build all program in tcl-build using a docker exec and default congratulations:

docker exec -it tcl-build bash /builds/all-build.sh

Build any applications with version customization in tcl-build using docker exec. For example install tcl version 8.6.11 is:

docker exec -it \
    -e TCL_VERSION=8.6.13 \
    tcl-build \
    bash /builds/tcl-build.sh

Modify the source code of any package in the workspaces directory. Then you can use make, cmake, … to rebuild the container with the changes. Use the build container with your favorite IDE.

Prepare source packages

Source packages are added to the Docker image using the builds/build-all.sh script.

To add packages or features create a two shell scripts in builds directory. One shell script will download the source package: yourpackage-download.sh. The other script will build the package: yourpackage-build.sh. Add your new build script, yourpackage-build.sh, to builds/all-build.sh.

Continues Integration

For build and push docker images using Github Actions workflow. Flow process is GitHub flow.

Maintenance

Log output

For debugging and maintenance purposes you may want access the output log. If you are using Docker version 1.3.0 or higher you can access a running containers shell by starting bash using docker interactive:

docker run -it --rm \
       --name=tcl-build \
       oupfiz5/tcl-build:latest \
       /bin/bash

Shell access

For debugging and maintenance purposes you may want access the containers shell. If you are usingDocker version 1.3.0 or higher you can access a running containers shell by starting bash using docker exec:

docker exec -it tcl-build /bin/bash