31 lines
724 B
Bash
31 lines
724 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
|
|
apt-get update
|
|
apt-get install -y ca-certificates curl git docker.io openssl
|
|
|
|
if [ -d /serve.zone ]; then
|
|
chown -R vagrant:vagrant /serve.zone
|
|
fi
|
|
|
|
systemctl enable --now docker
|
|
usermod -aG docker vagrant || true
|
|
|
|
if ! command -v node >/dev/null 2>&1; then
|
|
curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
apt-get install -y nodejs
|
|
fi
|
|
|
|
corepack enable
|
|
corepack prepare pnpm@10.7.0 --activate
|
|
|
|
swarm_state="$(docker info --format '{{.Swarm.LocalNodeState}}' 2>/dev/null || true)"
|
|
if [ "${swarm_state}" = "inactive" ]; then
|
|
docker swarm init --advertise-addr 127.0.0.1
|
|
fi
|
|
|
|
docker pull caddy:2-alpine
|
|
docker pull node:22-trixie-slim
|