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
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