add scripts to build & run with Docker
Or set DOCKER_BIN=podman to use Podman.
This commit is contained in:
parent
4981de4a04
commit
78b531ad8c
5 changed files with 53 additions and 3 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -2,5 +2,5 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
/.cache
|
/.cache
|
||||||
/.pytest_cache
|
/.pytest_cache
|
||||||
|
/build
|
||||||
/data/*
|
/data/*
|
||||||
/requirements.txt
|
|
||||||
|
|
|
||||||
2
poetry.lock
generated
2
poetry.lock
generated
|
|
@ -686,4 +686,4 @@ files = [
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.12"
|
python-versions = "^3.12"
|
||||||
content-hash = "fc07028820963701634eb55b42ea12962fd7c6fc25ef76ddadf30f2c74544b5f"
|
content-hash = "ba28f3acc8701a53b35b1c8ea15169e151c74c277bad095f52e19e3f65be9ed7"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "unwind"
|
name = "unwind"
|
||||||
version = "0.1.0"
|
version = "0"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["ducklet <ducklet@noreply.code.dumpr.org>"]
|
authors = ["ducklet <ducklet@noreply.code.dumpr.org>"]
|
||||||
license = "LOL"
|
license = "LOL"
|
||||||
|
|
@ -15,6 +15,13 @@ uvicorn = "^0.23"
|
||||||
httpx = "^0.24"
|
httpx = "^0.24"
|
||||||
sqlalchemy = {version = "^2.0", extras = ["aiosqlite"]}
|
sqlalchemy = {version = "^2.0", extras = ["aiosqlite"]}
|
||||||
|
|
||||||
|
[tool.poetry.group.build.dependencies]
|
||||||
|
# When we run poetry export, typing-extensions is a transient dependency via
|
||||||
|
# sqlalchemy, but the hash won't be included in the requirements.txt.
|
||||||
|
# By making it a direct dependency we can fix this issue, otherwise this could
|
||||||
|
# be removed.
|
||||||
|
typing-extensions = "*"
|
||||||
|
|
||||||
[tool.poetry.group.dev]
|
[tool.poetry.group.dev]
|
||||||
optional = true
|
optional = true
|
||||||
|
|
||||||
|
|
|
||||||
25
scripts/docker-build
Executable file
25
scripts/docker-build
Executable file
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh -eu
|
||||||
|
|
||||||
|
: "${DOCKER_BIN:=docker}"
|
||||||
|
|
||||||
|
cd "$RUN_DIR"
|
||||||
|
|
||||||
|
builddir=build
|
||||||
|
|
||||||
|
[ -z "${DEBUG:-}" ] || set -x
|
||||||
|
|
||||||
|
mkdir -p "$builddir"
|
||||||
|
|
||||||
|
poetry export \
|
||||||
|
--with=build \
|
||||||
|
--output="$builddir"/requirements.txt
|
||||||
|
|
||||||
|
githash=$(git rev-parse --short HEAD)
|
||||||
|
today=$(date -u '+%Y.%m.%d')
|
||||||
|
version="${today}+${githash}"
|
||||||
|
echo "$version" >"$builddir"/version
|
||||||
|
|
||||||
|
$DOCKER_BIN build \
|
||||||
|
--pull \
|
||||||
|
--tag "code.dumpr.org/ducklet/unwind":"$version" \
|
||||||
|
.
|
||||||
18
scripts/docker-run
Executable file
18
scripts/docker-run
Executable file
|
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh -eu
|
||||||
|
|
||||||
|
: "${DOCKER_BIN:=docker}"
|
||||||
|
|
||||||
|
cd "$RUN_DIR"
|
||||||
|
|
||||||
|
[ -z "${DEBUG:-}" ] || set -x
|
||||||
|
|
||||||
|
version=$(cat build/version)
|
||||||
|
|
||||||
|
$DOCKER_BIN run \
|
||||||
|
--init \
|
||||||
|
-it --rm \
|
||||||
|
--read-only \
|
||||||
|
--memory '500m' \
|
||||||
|
--publish 127.0.0.1:8000:8000 \
|
||||||
|
--volume "$RUN_DIR"/data:/data \
|
||||||
|
"code.dumpr.org/ducklet/unwind":"$version"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue