wip
This commit is contained in:
commit
d7800f4d82
12 changed files with 378 additions and 0 deletions
13
container/Containerfile
Normal file
13
container/Containerfile
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
FROM ubuntu:noble
|
||||
|
||||
ENV PATH="/root/.local/bin:$PATH"
|
||||
ENV VIRTUAL_ENV="/opt/venv"
|
||||
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
RUN apt-get update && apt-get install -y git curl
|
||||
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
RUN uv python install 3.13
|
||||
RUN uv venv $VIRTUAL_ENV
|
||||
RUN uv pip install hatch
|
||||
RUN curl https://i.wayl.one/casey/just | bash && mv just /usr/local/bin
|
||||
|
||||
68
container/justfile
Normal file
68
container/justfile
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
# 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
|
||||
|
||||
1
container/name
Normal file
1
container/name
Normal file
|
|
@ -0,0 +1 @@
|
|||
registry.wayl.one/wjust
|
||||
1
container/repository
Normal file
1
container/repository
Normal file
|
|
@ -0,0 +1 @@
|
|||
registry.wayl.one
|
||||
Loading…
Add table
Add a link
Reference in a new issue