-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-dockerfile.sh
More file actions
executable file
·28 lines (24 loc) · 929 Bytes
/
Copy pathbuild-dockerfile.sh
File metadata and controls
executable file
·28 lines (24 loc) · 929 Bytes
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
#!/bin/bash
set -euo pipefail
#!/bin/bash
set -euo pipefail
# Get the current git hash
GIT_HASH=$(git rev-parse --short HEAD)
DOTFILES_VERSION="0.0.1"
# Check if the git work tree is dirty (uncommitted changes)
if [ -n "$(git status --porcelain)" ]; then
# Dirty work tree: append '-ephemeral' to the git hash, do NOT tag with DOTFILES_VERSION
GIT_TAG="${GIT_HASH}-ephemeral"
echo "Dirty work tree detected. Tagging with git hash only: ${GIT_TAG}"
docker build --progress=plain \
-t "dev-container-yippee:${GIT_TAG}" \
-f dev.Dockerfile .
else
# Clean work tree: tag with both DOTFILES_VERSION and the git hash
GIT_TAG="${GIT_HASH}"
echo "Clean work tree. Tagging with DOTFILES_VERSION and git hash: ${GIT_TAG}"
docker build --progress=plain \
-t "dev-container-yippee:${DOTFILES_VERSION}" \
-t "dev-container-yippee:${GIT_TAG}" \
-f dev.Dockerfile .
fi