tangled
alpha
login
or
join now
tangled.org
/
knot-docker
89
fork
atom
Community maintained Docker config for the knot server
89
fork
atom
overview
issues
3
pulls
1
pipelines
try to do docker in nixery in docker
knotbin.com
6 months ago
5d41b551
84352122
0/1
publish.yml
failed
4s
+29
1 changed file
expand all
collapse all
unified
split
.tangled
workflows
publish.yml
+29
.tangled/workflows/publish.yml
···
11
11
- coreutils
12
12
- gnused
13
13
- gnugrep
14
14
+
- bash
14
15
15
16
steps:
17
17
+
- name: "Check Docker availability"
18
18
+
command: |
19
19
+
echo "Checking Docker availability..."
20
20
+
which docker || echo "Docker not found in PATH"
21
21
+
docker --version || echo "Docker version check failed"
22
22
+
docker info || echo "Docker daemon not running"
23
23
+
ls -la /var/run/docker.sock || echo "Docker socket not found"
24
24
+
16
25
- name: "Extract version from Dockerfile"
17
26
command: |
27
27
+
if [ ! -f "Dockerfile" ]; then
28
28
+
echo "ERROR: Dockerfile not found"
29
29
+
exit 1
30
30
+
fi
18
31
export TAG=$(grep -iE '^arg TAG=' Dockerfile | sed -E "s/arg TAG='?([^']+)'?/\1/i")
32
32
+
if [ -z "$TAG" ]; then
33
33
+
echo "ERROR: Could not extract TAG from Dockerfile"
34
34
+
echo "Dockerfile content:"
35
35
+
cat Dockerfile
36
36
+
exit 1
37
37
+
fi
19
38
echo "Detected TAG=$TAG"
20
39
if [ -n "$TANGLED_ENV_FILE" ]; then
21
40
echo "TAG=$TAG" >> "$TANGLED_ENV_FILE"
···
23
42
24
43
- name: "Log in to Docker Hub"
25
44
command: |
45
45
+
if [ -z "$DOCKER_USERNAME" ] || [ -z "$DOCKER_PASSWORD" ]; then
46
46
+
echo "ERROR: DOCKER_USERNAME or DOCKER_PASSWORD not set"
47
47
+
exit 1
48
48
+
fi
49
49
+
echo "Logging in as: $DOCKER_USERNAME"
26
50
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
27
51
28
52
- name: "Build Docker image"
29
53
command: |
54
54
+
if [ -z "$TAG" ]; then
55
55
+
echo "ERROR: TAG variable not set"
56
56
+
exit 1
57
57
+
fi
58
58
+
echo "Building image: $DOCKER_USERNAME/$DOCKER_REPO:$TAG"
30
59
docker build --build-arg TAG="$TAG" -t "$DOCKER_USERNAME/$DOCKER_REPO:$TAG" .
31
60
docker tag "$DOCKER_USERNAME/$DOCKER_REPO:$TAG" "$DOCKER_USERNAME/$DOCKER_REPO:latest"
32
61