build(docker): Local Docker image build/testing
This commit is contained in:
parent
684ba9a314
commit
f68f9c7928
4 changed files with 73 additions and 4 deletions
1
docker/Dockerfile.headless
Symbolic link
1
docker/Dockerfile.headless
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
Dockerfile
|
||||||
46
docker/testing/Makefile
Normal file
46
docker/testing/Makefile
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
# Local building and testing of the Docker image variants.
|
||||||
|
|
||||||
|
# Defensive settings for make:
|
||||||
|
# https://tech.davis-hansson.com/p/make/
|
||||||
|
SHELL:=bash
|
||||||
|
.ONESHELL:
|
||||||
|
.SHELLFLAGS:=-eu -o pipefail -c
|
||||||
|
.SILENT:
|
||||||
|
.DELETE_ON_ERROR:
|
||||||
|
MAKEFLAGS+=--warn-undefined-variables
|
||||||
|
MAKEFLAGS+=--no-builtin-rules
|
||||||
|
export PS1?=$$
|
||||||
|
# Prefix echoed recipe commands with the recipe line number for debugging:
|
||||||
|
export PS4?=:$$LINENO+
|
||||||
|
|
||||||
|
VARIANTS=headless gui ubuntu
|
||||||
|
ROOT_PREREQS:=$(shell find ../root -type f)
|
||||||
|
|
||||||
|
# Finished with `$(shell)`, echo recipe commands going forward
|
||||||
|
.SHELLFLAGS+= -x
|
||||||
|
|
||||||
|
|
||||||
|
### Top-level targets:
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: build
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
build: $(VARIANTS:%=./build/ytdl-sub-%.log)
|
||||||
|
|
||||||
|
.PHONY: run
|
||||||
|
run: build $(VARIANTS:%=./volumes/ytdl-sub-%/)
|
||||||
|
docker compose up
|
||||||
|
|
||||||
|
|
||||||
|
### Real targets:
|
||||||
|
|
||||||
|
# Re-build the local images when changes require it.
|
||||||
|
./build/ytdl-sub-%.log: ../Dockerfile.% $(ROOT_PREREQS)
|
||||||
|
mkdir -pv "$(dir $(@))"
|
||||||
|
docker compose build "$(@:build/ytdl-sub-%.log=ytdl-sub-%)" |&
|
||||||
|
tee -a "$(@)"
|
||||||
|
|
||||||
|
# Ensure volumes are owned by the developer's normal user:
|
||||||
|
./volumes/ytdl-sub-%/:
|
||||||
|
mkdir -pv "$(@)"
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
services:
|
services:
|
||||||
ytdl-sub-gui:
|
ytdl-sub-gui:
|
||||||
|
build:
|
||||||
|
context: "../"
|
||||||
|
dockerfile: "./Dockerfile.gui"
|
||||||
image: "ytdl-sub-gui:local"
|
image: "ytdl-sub-gui:local"
|
||||||
container_name: "ytdl-sub-gui"
|
container_name: "ytdl-sub-gui"
|
||||||
environment:
|
environment:
|
||||||
|
|
@ -13,9 +16,11 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "8443:8443"
|
- "8443:8443"
|
||||||
restart: "unless-stopped"
|
restart: "unless-stopped"
|
||||||
ytdl-sub:
|
ytdl-sub-headless:
|
||||||
image: "ytdl-sub:local"
|
build:
|
||||||
container_name: "ytdl-sub"
|
context: "../"
|
||||||
|
image: "ytdl-sub-headless:local"
|
||||||
|
container_name: "ytdl-sub-headless"
|
||||||
environment:
|
environment:
|
||||||
PUID: "1000"
|
PUID: "1000"
|
||||||
PGID: "1000"
|
PGID: "1000"
|
||||||
|
|
@ -23,9 +28,12 @@ services:
|
||||||
CRON_SCHEDULE: '"*/1 * * * *"'
|
CRON_SCHEDULE: '"*/1 * * * *"'
|
||||||
CRON_RUN_ON_START: "true"
|
CRON_RUN_ON_START: "true"
|
||||||
volumes:
|
volumes:
|
||||||
- "./volumes/ytdl-sub/:/config/"
|
- "./volumes/ytdl-sub-headless/:/config/"
|
||||||
restart: "unless-stopped"
|
restart: "unless-stopped"
|
||||||
ytdl-sub-ubuntu:
|
ytdl-sub-ubuntu:
|
||||||
|
build:
|
||||||
|
context: "../"
|
||||||
|
dockerfile: "./Dockerfile.ubuntu"
|
||||||
image: "ytdl-sub-ubuntu:local"
|
image: "ytdl-sub-ubuntu:local"
|
||||||
container_name: "ytdl-sub-ubuntu"
|
container_name: "ytdl-sub-ubuntu"
|
||||||
environment:
|
environment:
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,20 @@ If integration tests are failing, ensure...
|
||||||
- your local ``ytdl-sub`` dependencies are up-to-date
|
- your local ``ytdl-sub`` dependencies are up-to-date
|
||||||
|
|
||||||
|
|
||||||
|
Docker
|
||||||
|
------
|
||||||
|
|
||||||
|
Test changes to the Docker image variants locally:
|
||||||
|
|
||||||
|
.. code-block:: shell
|
||||||
|
|
||||||
|
cd ./docker/testing/
|
||||||
|
make -j run
|
||||||
|
|
||||||
|
See ``./docker/testing/docker-compose.yml`` for the Compose services for each image
|
||||||
|
variant.
|
||||||
|
|
||||||
|
|
||||||
IDE Setup
|
IDE Setup
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue