-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-build.sh
More file actions
executable file
·39 lines (32 loc) · 1.27 KB
/
docker-build.sh
File metadata and controls
executable file
·39 lines (32 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
set -euo pipefail
# ─────────────────────────────────────────────────────────
# docker-build.sh - Build SimpleAuth Docker image (linux/amd64)
# and save as dist/simpleauth.tar
#
# Usage: ./docker-build.sh
# ─────────────────────────────────────────────────────────
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
VERSION=$(cat VERSION)
BUILD_TIME=$(date -u '+%Y-%m-%dT%H:%M:%SZ')
IMAGE_NAME="simpleauth"
IMAGE_TAG="${IMAGE_NAME}:${VERSION}"
OUTPUT_DIR="${SCRIPT_DIR}/dist"
OUTPUT_FILE="${OUTPUT_DIR}/simpleauth.tar"
mkdir -p "$OUTPUT_DIR"
echo "=== Building SimpleAuth Docker Image ==="
echo " Version: ${VERSION}"
echo " Platform: linux/amd64"
echo " Output: ${OUTPUT_FILE}"
docker buildx build \
--platform linux/amd64 \
--tag "$IMAGE_TAG" \
--tag "${IMAGE_NAME}:latest" \
--build-arg "VERSION=${VERSION}" \
--build-arg "BUILD_TIME=${BUILD_TIME}" \
--output "type=docker,dest=${OUTPUT_FILE}" \
.
SIZE=$(du -sh "$OUTPUT_FILE" | cut -f1)
echo ""
echo "=== Done. ${OUTPUT_FILE} (${SIZE}) ==="