refactor: docker to podman (#38)

This commit is contained in:
Marc 2024-02-09 00:23:14 -05:00 committed by GitHub
commit ded4fe92b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 47 additions and 48 deletions

View file

@ -17,6 +17,9 @@ vars:
sh: git describe --tags --exact-match $(git rev-parse HEAD) 2> /dev/null || echo "dev-$(git rev-parse HEAD)" sh: git describe --tags --exact-match $(git rev-parse HEAD) 2> /dev/null || echo "dev-$(git rev-parse HEAD)"
tasks: tasks:
ensure-pod:
desc: "Creates the pod if it doesn't already exist."
cmd: . ./pod.sh
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."
cmds: cmds:
@ -28,6 +31,7 @@ tasks:
prefix: "build: {{ .CLI_ARGS }}" prefix: "build: {{ .CLI_ARGS }}"
dir: services dir: services
start: start:
deps: [ensure-pod]
desc: "Starts one or more services. Include service names as a space-separated list." desc: "Starts one or more services. Include service names as a space-separated list."
cmds: cmds:
- for: { var: CLI_ARGS } - for: { var: CLI_ARGS }

1
apt.txt Normal file
View file

@ -0,0 +1 @@
podman

4
pod.sh Normal file
View file

@ -0,0 +1,4 @@
#!/bin/bash
podman pod exists services || true
test $? -eq 0 || podman pod create -p 8080:8080 -p 6881:6881/udp -p 6881:6881 -p 8112:8112 services

7
provision.sh Normal file
View file

@ -0,0 +1,7 @@
#/bin/bash
# Ensure that dependencies are up to date.
sudo apt update && sudo apt upgrade -y --autoremove
# Ensure that critical dependencies are installed.
sudo apt install $(cat apt.txt) -y

View file

@ -2,4 +2,4 @@
source constants.sh source constants.sh
docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bastion-app . podman build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bastion-app .

View file

@ -3,4 +3,3 @@
export APP_NAME="bastion" export APP_NAME="bastion"
export APP_CONTAINER_NAME=$APP_NAME-app export APP_CONTAINER_NAME=$APP_NAME-app
export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME
export NETWORK_NAME=$APP_NAME-local

View file

@ -2,11 +2,9 @@
source constants.sh source constants.sh
docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" podman run \
docker run \
--detach \ --detach \
--network $NETWORK_NAME \ --pod services \
--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:$IMAGE_VERSION $APP_IMAGE_NAME:$IMAGE_VERSION

View file

@ -2,4 +2,4 @@
source constants.sh source constants.sh
docker rm -f $APP_CONTAINER_NAME podman rm -f $APP_CONTAINER_NAME

View file

@ -2,5 +2,5 @@
source constants.sh source constants.sh
docker build -t $DB_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bitwarden-db . podman build -t $DB_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bitwarden-db .
docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bitwarden-app . podman build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bitwarden-app .

View file

@ -5,4 +5,3 @@ export APP_CONTAINER_NAME=$APP_NAME-app
export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME
export DB_CONTAINER_NAME=$APP_NAME-db export DB_CONTAINER_NAME=$APP_NAME-db
export DB_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$DB_CONTAINER_NAME export DB_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$DB_CONTAINER_NAME
export NETWORK_NAME=$APP_NAME-local

View file

@ -2,22 +2,19 @@
source constants.sh source constants.sh
docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" podman run \
docker run \
--detach \ --detach \
--network $NETWORK_NAME \ --pod services \
--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:$IMAGE_VERSION $DB_IMAGE_NAME:$IMAGE_VERSION
docker run \ podman run \
--detach \ --detach \
--network $NETWORK_NAME \ --pod services \
--name $APP_CONTAINER_NAME \ --name $APP_CONTAINER_NAME \
--env-file $ENV_FILE_DIR/bitwarden-web.env \ --env-file $ENV_FILE_DIR/bitwarden-web.env \
--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:$IMAGE_VERSION $APP_IMAGE_NAME:$IMAGE_VERSION

View file

@ -2,5 +2,5 @@
source constants.sh source constants.sh
docker rm -f $APP_CONTAINER_NAME podman rm -f $APP_CONTAINER_NAME
docker rm -f $DB_CONTAINER_NAME podman rm -f $DB_CONTAINER_NAME

View file

@ -2,5 +2,5 @@
source constants.sh source constants.sh
docker build -t $DB_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bookstack-db . podman build -t $DB_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bookstack-db .
docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bookstack-app . podman build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-bookstack-app .

View file

@ -5,4 +5,3 @@ export APP_CONTAINER_NAME=$APP_NAME-app
export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME
export DB_CONTAINER_NAME=$APP_NAME-db export DB_CONTAINER_NAME=$APP_NAME-db
export DB_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$DB_CONTAINER_NAME export DB_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$DB_CONTAINER_NAME
export NETWORK_NAME=$APP_NAME-local

View file

@ -2,21 +2,19 @@
source constants.sh source constants.sh
docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" podman run \
docker run \
--detach \ --detach \
--network $NETWORK_NAME \ --pod services \
--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:$IMAGE_VERSION mariadb:10.6 \
--port 3307
docker run \ podman run \
--detach \ --detach \
--network $NETWORK_NAME \ --pod services \
--name $APP_CONTAINER_NAME \ --name $APP_CONTAINER_NAME \
--env-file $ENV_FILE_DIR/bookstack-app.env \ --env-file $ENV_FILE_DIR/bookstack-app.env \
--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:$IMAGE_VERSION $APP_IMAGE_NAME:$IMAGE_VERSION

View file

@ -2,5 +2,5 @@
source constants.sh source constants.sh
docker rm -f $APP_CONTAINER_NAME podman rm -f $APP_CONTAINER_NAME
docker rm -f $DB_CONTAINER_NAME podman rm -f $DB_CONTAINER_NAME

View file

@ -2,4 +2,4 @@
source constants.sh source constants.sh
docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-deluge-app . podman build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-deluge-app .

View file

@ -3,4 +3,3 @@
export APP_NAME="deluge" export APP_NAME="deluge"
export APP_CONTAINER_NAME=$APP_NAME-app export APP_CONTAINER_NAME=$APP_NAME-app
export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME export APP_IMAGE_NAME=$CONTAINER_NAME_PREFIX-$APP_CONTAINER_NAME
export NETWORK_NAME=$APP_NAME-local

View file

@ -2,16 +2,13 @@
source constants.sh source constants.sh
docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" podman run \
docker run \
--detach \ --detach \
--network $NETWORK_NAME \ --pod services \
-e PGUID=1000 \
-e PGID=1000 \
--name $APP_CONTAINER_NAME \ --name $APP_CONTAINER_NAME \
--env-file $ENV_FILE_DIR/deluge.env \ --env-file $ENV_FILE_DIR/deluge.env \
--publish 8112:8112 \
--publish 6881:6881/udp \
--publish 6881:6881/tcp \
--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 \

View file

@ -2,4 +2,4 @@
source constants.sh source constants.sh
docker rm -f $APP_CONTAINER_NAME podman rm -f $APP_CONTAINER_NAME

View file

@ -2,4 +2,4 @@
source constants.sh source constants.sh
docker build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-plex-app . podman build -t $APP_IMAGE_NAME:$IMAGE_VERSION -f Dockerfile-plex-app .

View file

@ -2,11 +2,8 @@
source constants.sh source constants.sh
docker network create $NETWORK_NAME || echo "Network $NETWORK_NAME already exists" podman run \
docker run \
--detach \ --detach \
--network $NETWORK_NAME \
--name $APP_CONTAINER_NAME \ --name $APP_CONTAINER_NAME \
--env-file $ENV_FILE_DIR/plex.env \ --env-file $ENV_FILE_DIR/plex.env \
--publish 32401:32400 \ --publish 32401:32400 \

View file

@ -2,4 +2,4 @@
source constants.sh source constants.sh
docker rm -f $APP_CONTAINER_NAME podman rm -f $APP_CONTAINER_NAME