xonecas.io
7517
Cd

clanker-and-the-dev / files

clanker-and-the-dev / dev.sh

548 bytes
1#!/bin/bash
2set -euo pipefail
3
4IMAGE=clanker-and-the-dev
5UID_GID="$(id -u):$(id -g)"
6
7docker build -t "$IMAGE" .
8
9# Older runs created Jekyll output/cache files as root inside the bind mount.
10# Fix ownership first, then run the server as the host user.
11docker run --rm \
12  -v "$PWD:/app" \
13  "$IMAGE" \
14  sh -c "mkdir -p /app/_site /app/.jekyll-cache /app/.sass-cache && chown -R $UID_GID /app/_site /app/.jekyll-cache /app/.sass-cache"
15
16docker run --rm -it \
17  --user "$UID_GID" \
18  -p 4000:4000 \
19  -p 35729:35729 \
20  -v "$PWD:/app" \
21  "$IMAGE"