68 lines
1.7 KiB
Makefile
68 lines
1.7 KiB
Makefile
# container management
|
|
set working-directory := '.'
|
|
set shell := ["bash", "-c"]
|
|
set quiet
|
|
|
|
# Read container name and version
|
|
container_name := `
|
|
cd $JUST_WORKING_DIRECTORY
|
|
if [[ -f container/name ]]; then cat container/name; else echo "NONAME"; fi
|
|
`
|
|
|
|
version := `
|
|
cd $JUST_WORKING_DIRECTORY
|
|
ABOUT_FILE=$(rg -l "__version__" --glob "**/__about__.py" 2>/dev/null | head -n 1) || true
|
|
if [[ -n "$ABOUT_FILE" ]] && [[ -f "$ABOUT_FILE" ]]; then
|
|
rg -oP "(?<=__version__ = ['\"])[^'\"]+" "$ABOUT_FILE"
|
|
elif [[ -f "version" ]]; then
|
|
cat version
|
|
else
|
|
echo "0.0.0"
|
|
fi
|
|
`
|
|
|
|
|
|
|
|
[group('container')]
|
|
[private]
|
|
@default: check
|
|
#!/usr/bin/env bash
|
|
cd $JUST_WORKING_DIRECTORY
|
|
echo $PWD
|
|
echo
|
|
echo {{BOLD}}just container{{NORMAL}}
|
|
echo {{MAGENTA}}{{container_name}}{{WHITE}}:{{GREEN}}{{version}}{{NORMAL}}
|
|
|
|
[group('container')]
|
|
[private]
|
|
check:
|
|
#!/usr/bin/env bash
|
|
cd $JUST_WORKING_DIRECTORY
|
|
[[ -f container/Containerfile ]] || echo "{{RED}}WARNING: {{NORMAL}}Containerfile not found"
|
|
|
|
|
|
# build the container
|
|
[group('container')]
|
|
build:
|
|
@echo "Building {{container_name}}:{{version}}"
|
|
@# @podman build \
|
|
@# -t {{container_name}}:{{version}} \
|
|
@# -f container/Containerfile .
|
|
|
|
# push the container
|
|
[group('container')]
|
|
@deploy:
|
|
@podman push {{container_name}}
|
|
@podman push {{container_name}}:{{version}}
|
|
|
|
# init container workflow
|
|
[no-cd]
|
|
[group('container')]
|
|
init:
|
|
#!/usr/bin/env bash
|
|
[[ -d container ]] || mkdir container
|
|
export project_name=$(basename $(pwd))
|
|
[[ -f version ]] || echo "version = '0.0.0'" > version
|
|
[[ -f container/name ]] || echo $project_name > container/name
|
|
[[ -f container/Containerfile ]] || echo "FROM ubuntu" > container/Containerfile
|
|
|