feat: tag image version on build + start (#36)
This commit is contained in:
commit
53d9690876
13 changed files with 30 additions and 14 deletions
|
@ -35,3 +35,8 @@ env:
|
||||||
```
|
```
|
||||||
|
|
||||||
The `env.yml` file is ignored by version-control.
|
The `env.yml` file is ignored by version-control.
|
||||||
|
|
||||||
|
### Image versions
|
||||||
|
|
||||||
|
When building and starting images, images are tagged with either the release version (if on a commit that's tagged with
|
||||||
|
a release) or a dev tag that includes the hash (i.e. `dev-<commit-hash>`).
|
||||||
|
|
|
@ -8,10 +8,14 @@ tasks:
|
||||||
prefix: "build image: {{ .SERVICE }}"
|
prefix: "build image: {{ .SERVICE }}"
|
||||||
dir: services/{{ .SERVICE }}
|
dir: services/{{ .SERVICE }}
|
||||||
cmd: . ./build.sh
|
cmd: . ./build.sh
|
||||||
|
env:
|
||||||
|
IMAGE_VERSION: "{{ .VERSION }}"
|
||||||
start-service:
|
start-service:
|
||||||
prefix: "start: {{ .SERVICE }}"
|
prefix: "start: {{ .SERVICE }}"
|
||||||
dir: services/{{ .SERVICE }}
|
dir: services/{{ .SERVICE }}
|
||||||
cmd: . ./start.sh
|
cmd: . ./start.sh
|
||||||
|
env:
|
||||||
|
IMAGE_VERSION: "{{ .VERSION }}"
|
||||||
stop-service:
|
stop-service:
|
||||||
prefix: "stop: {{ .SERVICE }}"
|
prefix: "stop: {{ .SERVICE }}"
|
||||||
dir: services/{{ .SERVICE }}
|
dir: services/{{ .SERVICE }}
|
||||||
|
|
|
@ -11,6 +11,11 @@ includes:
|
||||||
|
|
||||||
output: prefixed
|
output: prefixed
|
||||||
|
|
||||||
|
vars:
|
||||||
|
# Any build that is not on a tag is a development build.
|
||||||
|
CURRENT_VERSION:
|
||||||
|
sh: git describe --tags --exact-match $(git rev-parse HEAD) 2> /dev/null || echo "dev-$(git rev-parse HEAD)"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
build:
|
build:
|
||||||
desc: "Builds images for one or more services. Include service names as a space-separated list."
|
desc: "Builds images for one or more services. Include service names as a space-separated list."
|
||||||
|
@ -19,6 +24,7 @@ tasks:
|
||||||
task: internal:build-images
|
task: internal:build-images
|
||||||
vars:
|
vars:
|
||||||
SERVICE: "{{ .ITEM }}"
|
SERVICE: "{{ .ITEM }}"
|
||||||
|
VERSION: "{{ .CURRENT_VERSION }}"
|
||||||
prefix: "build: {{ .CLI_ARGS }}"
|
prefix: "build: {{ .CLI_ARGS }}"
|
||||||
dir: services
|
dir: services
|
||||||
start:
|
start:
|
||||||
|
@ -28,6 +34,7 @@ tasks:
|
||||||
task: internal:start-service
|
task: internal:start-service
|
||||||
vars:
|
vars:
|
||||||
SERVICE: "{{ .ITEM }}"
|
SERVICE: "{{ .ITEM }}"
|
||||||
|
VERSION: "{{ .CURRENT_VERSION }}"
|
||||||
prefix: "start: {{ .CLI_ARGS }}"
|
prefix: "start: {{ .CLI_ARGS }}"
|
||||||
dir: services
|
dir: services
|
||||||
stop:
|
stop:
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
source constants.sh
|
source constants.sh
|
||||||
|
|
||||||
docker build -t $APP_IMAGE_NAME:dev -f Dockerfile-bastion-app .
|
docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bastion-app .
|
||||||
|
|
|
@ -9,4 +9,4 @@ docker run \
|
||||||
--network $NETWORK_NAME \
|
--network $NETWORK_NAME \
|
||||||
--name $APP_CONTAINER_NAME \
|
--name $APP_CONTAINER_NAME \
|
||||||
--env-file $ENV_FILE_DIR/bastion.env \
|
--env-file $ENV_FILE_DIR/bastion.env \
|
||||||
$APP_IMAGE_NAME:dev
|
$APP_IMAGE_NAME:$IMAGE_VERSION
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
source constants.sh
|
source constants.sh
|
||||||
|
|
||||||
docker build -t $DB_IMAGE_NAME:dev -f Dockerfile-bitwarden-db .
|
docker build -t $DB_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bitwarden-db .
|
||||||
docker build -t $APP_IMAGE_NAME:dev -f Dockerfile-bitwarden-app .
|
docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bitwarden-app .
|
||||||
|
|
|
@ -10,7 +10,7 @@ docker run \
|
||||||
--name $DB_CONTAINER_NAME \
|
--name $DB_CONTAINER_NAME \
|
||||||
--env-file $ENV_FILE_DIR/bitwarden-db.env \
|
--env-file $ENV_FILE_DIR/bitwarden-db.env \
|
||||||
--mount type=bind,source=$APP_DATA_DIR/bitwarden/db,target=/var/lib/mysql \
|
--mount type=bind,source=$APP_DATA_DIR/bitwarden/db,target=/var/lib/mysql \
|
||||||
$DB_IMAGE_NAME:dev
|
$DB_IMAGE_NAME:$IMAGE_VERSION
|
||||||
|
|
||||||
docker run \
|
docker run \
|
||||||
--detach \
|
--detach \
|
||||||
|
@ -20,4 +20,4 @@ docker run \
|
||||||
--publish 8080:8080 \
|
--publish 8080:8080 \
|
||||||
--mount type=bind,source=$APP_DATA_DIR/bitwarden/config,target=/etc/bitwarden \
|
--mount type=bind,source=$APP_DATA_DIR/bitwarden/config,target=/etc/bitwarden \
|
||||||
--mount type=bind,source=$APP_DATA_DIR/bitwarden/logs,target=/var/log/bitwarden \
|
--mount type=bind,source=$APP_DATA_DIR/bitwarden/logs,target=/var/log/bitwarden \
|
||||||
$APP_IMAGE_NAME:dev
|
$APP_IMAGE_NAME:$IMAGE_VERSION
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
source constants.sh
|
source constants.sh
|
||||||
|
|
||||||
docker build -t $DB_IMAGE_NAME:dev -f Dockerfile-bookstack-db .
|
docker build -t $DB_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bookstack-db .
|
||||||
docker build -t $APP_IMAGE_NAME:dev -f Dockerfile-bookstack-app .
|
docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bookstack-app .
|
||||||
|
|
|
@ -10,7 +10,7 @@ docker run \
|
||||||
--name $DB_CONTAINER_NAME \
|
--name $DB_CONTAINER_NAME \
|
||||||
--env-file $ENV_FILE_DIR/bookstack-db.env \
|
--env-file $ENV_FILE_DIR/bookstack-db.env \
|
||||||
--mount type=bind,source=$APP_DATA_DIR/bookstack-db,target=/var/lib/mysql \
|
--mount type=bind,source=$APP_DATA_DIR/bookstack-db,target=/var/lib/mysql \
|
||||||
$DB_IMAGE_NAME:dev
|
$DB_IMAGE_NAME:$IMAGE_VERSION
|
||||||
|
|
||||||
docker run \
|
docker run \
|
||||||
--detach \
|
--detach \
|
||||||
|
@ -19,4 +19,4 @@ docker run \
|
||||||
--env-file $ENV_FILE_DIR/bookstack-app.env \
|
--env-file $ENV_FILE_DIR/bookstack-app.env \
|
||||||
--publish 6875:80 \
|
--publish 6875:80 \
|
||||||
--mount type=bind,source=$APP_DATA_DIR/bookstack-app,target=/config \
|
--mount type=bind,source=$APP_DATA_DIR/bookstack-app,target=/config \
|
||||||
$APP_IMAGE_NAME:dev
|
$APP_IMAGE_NAME:$IMAGE_VERSION
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
source constants.sh
|
source constants.sh
|
||||||
|
|
||||||
docker build -t $APP_IMAGE_NAME:dev -f Dockerfile-deluge-app .
|
docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-deluge-app .
|
||||||
|
|
|
@ -15,4 +15,4 @@ docker run \
|
||||||
--mount type=bind,source=$APP_DATA_DIR/deluge/config,target=/config \
|
--mount type=bind,source=$APP_DATA_DIR/deluge/config,target=/config \
|
||||||
--mount type=bind,source=$APP_DATA_DIR/deluge/downloads,target=/downloads \
|
--mount type=bind,source=$APP_DATA_DIR/deluge/downloads,target=/downloads \
|
||||||
--mount type=bind,source=$STORAGE_DIR,target=/complete \
|
--mount type=bind,source=$STORAGE_DIR,target=/complete \
|
||||||
$APP_IMAGE_NAME:dev
|
$APP_IMAGE_NAME:$IMAGE_VERSION
|
||||||
|
|
|
@ -2,4 +2,4 @@
|
||||||
|
|
||||||
source constants.sh
|
source constants.sh
|
||||||
|
|
||||||
docker build -t $APP_IMAGE_NAME:dev -f Dockerfile-plex-app .
|
docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-plex-app .
|
||||||
|
|
|
@ -21,4 +21,4 @@ docker run \
|
||||||
--mount type=bind,source=$APP_DATA_DIR/plex/database,target=/config \
|
--mount type=bind,source=$APP_DATA_DIR/plex/database,target=/config \
|
||||||
--mount type=bind,source=$APP_DATA_DIR/plex/transcode,target=/transcode \
|
--mount type=bind,source=$APP_DATA_DIR/plex/transcode,target=/transcode \
|
||||||
--mount type=bind,source=$STORAGE_DIR/media,target=/data \
|
--mount type=bind,source=$STORAGE_DIR/media,target=/data \
|
||||||
$APP_IMAGE_NAME:dev
|
$APP_IMAGE_NAME:$IMAGE_VERSION
|
||||||
|
|
Reference in a new issue