Compare commits
No commits in common. "083e54e1457a4382c45ac82915b76b942b717cb2" and "e927d4d18ae0cdba63bd438ee30341989cf232ab" have entirely different histories.
083e54e145
...
e927d4d18a
1 changed files with 5 additions and 33 deletions
38
build.sh
38
build.sh
|
|
@ -1,17 +1,15 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Build the owpengram-server container image (stamping the current git state into
|
# Build the owpengram-server container image, stamping the current git state
|
||||||
# the binary - .containerignore excludes .git, so go build can't see the repo and
|
# into the binary (shows up in telesrv's startup log as git_commit/git_branch/
|
||||||
# the values are passed in here), then recreate and start the pod containers.
|
# git_tree_state/build_time). .containerignore excludes .git, so go build's
|
||||||
|
# automatic VCS stamping can't see the repo - the values are passed in here.
|
||||||
#
|
#
|
||||||
# Usage: ./build.sh [extra podman build args...]
|
# Usage: ./build.sh [extra podman build args...]
|
||||||
# IMAGE=my/tag ./build.sh override the image tag (default: owpengram-server)
|
# IMAGE=my/tag ./build.sh # override the image tag (default: owpengram-server)
|
||||||
# POD=name ./build.sh override the pod name (default: owpengram)
|
|
||||||
# NO_DEPLOY=1 ./build.sh build the image only, don't touch containers
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
IMAGE="${IMAGE:-owpengram-server}"
|
IMAGE="${IMAGE:-owpengram-server}"
|
||||||
POD="${POD:-owpengram}"
|
|
||||||
|
|
||||||
podman build \
|
podman build \
|
||||||
--build-arg GIT_COMMIT="$(git rev-parse HEAD)" \
|
--build-arg GIT_COMMIT="$(git rev-parse HEAD)" \
|
||||||
|
|
@ -22,29 +20,3 @@ podman build \
|
||||||
-f Containerfile \
|
-f Containerfile \
|
||||||
"$@" \
|
"$@" \
|
||||||
.
|
.
|
||||||
|
|
||||||
if [ "${NO_DEPLOY:-0}" = "1" ]; then
|
|
||||||
echo "built $IMAGE (NO_DEPLOY=1, containers unchanged)"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! podman pod exists "$POD"; then
|
|
||||||
echo "error: pod '$POD' does not exist - create it first, e.g.:" >&2
|
|
||||||
echo " podman pod create --name $POD -p 127.0.0.1:2401:2401" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [ ! -f .env ]; then
|
|
||||||
echo "error: .env not found (containers are created with --env-file .env)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
podman create --replace --pod "$POD" --name owpengram-server --restart unless-stopped \
|
|
||||||
--pull never --env-file .env -v owpengram_serverdata:/data \
|
|
||||||
"$IMAGE"
|
|
||||||
|
|
||||||
podman create --replace --pod "$POD" --name owpengram-admin --restart unless-stopped \
|
|
||||||
--pull never --env-file .env --entrypoint /app/telesrv-admin \
|
|
||||||
"$IMAGE"
|
|
||||||
|
|
||||||
podman start owpengram-server owpengram-admin
|
|
||||||
podman ps --pod --filter "pod=$POD" --format 'table {{.Names}} {{.Status}} {{.Image}}'
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue