tangled
alpha
login
or
join now
tangled.org
/
knot-docker
90
fork
atom
Community maintained Docker config for the knot server
90
fork
atom
overview
issues
3
pulls
1
pipelines
policy config
knotbin.com
6 months ago
b03e02c0
158f2271
+53
-8
1 changed file
expand all
collapse all
unified
split
.tangled
workflows
publish.yml
+53
-8
.tangled/workflows/publish.yml
···
50
# Suppress buildah user warnings in CI environment
51
export BUILDAH_ISOLATION=chroot
52
export XDG_RUNTIME_DIR=/tmp/buildah-runtime
0
0
53
mkdir -p $XDG_RUNTIME_DIR
54
55
# Create a new container from alpine
···
102
103
- name: "Convert buildah image to Docker format and push"
104
command: |
0
0
0
0
0
0
0
105
# Source the environment
106
source ~/.bashrc || true
107
if [ -n "$TANGLED_ENV_FILE" ] && [ -f "$TANGLED_ENV_FILE" ]; then
···
118
exit 1
119
fi
120
121
-
# Export buildah image to docker format
122
-
buildah push localhost/$DOCKER_USERNAME/$DOCKER_REPO:$TAG docker-archive:image-$TAG.tar
123
-
buildah push localhost/$DOCKER_USERNAME/$DOCKER_REPO:latest docker-archive:image-latest.tar
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
124
125
-
# Use skopeo to push to Docker Hub with proper login
126
echo "Logging in to Docker Hub..."
127
-
echo "$DOCKER_PASSWORD" | skopeo login docker.io -u "$DOCKER_USERNAME" --password-stdin
0
0
0
128
129
echo "Pushing image: $DOCKER_USERNAME/$DOCKER_REPO:$TAG"
130
131
# Push the tagged image
132
skopeo copy \
133
docker-archive:image-$TAG.tar \
134
-
docker://docker.io/$DOCKER_USERNAME/$DOCKER_REPO:$TAG
0
0
0
135
136
# Push as latest
137
skopeo copy \
138
docker-archive:image-latest.tar \
139
-
docker://docker.io/$DOCKER_USERNAME/$DOCKER_REPO:latest
0
0
0
140
141
-
echo "Successfully pushed both $TAG and latest tags"
142
143
environment:
144
GIT_COMMIT: "${CI_COMMIT_SHA}"
···
50
# Suppress buildah user warnings in CI environment
51
export BUILDAH_ISOLATION=chroot
52
export XDG_RUNTIME_DIR=/tmp/buildah-runtime
53
+
export BUILDAH_LOG_LEVEL=warn
54
+
export BUILDAH_QUIET=1
55
mkdir -p $XDG_RUNTIME_DIR
56
57
# Create a new container from alpine
···
104
105
- name: "Convert buildah image to Docker format and push"
106
command: |
107
+
# Suppress buildah user warnings in CI environment
108
+
export BUILDAH_ISOLATION=chroot
109
+
export XDG_RUNTIME_DIR=/tmp/buildah-runtime
110
+
export BUILDAH_LOG_LEVEL=warn
111
+
export BUILDAH_QUIET=1
112
+
mkdir -p $XDG_RUNTIME_DIR
113
+
114
# Source the environment
115
source ~/.bashrc || true
116
if [ -n "$TANGLED_ENV_FILE" ] && [ -f "$TANGLED_ENV_FILE" ]; then
···
127
exit 1
128
fi
129
130
+
# Create skopeo trust policy file
131
+
mkdir -p ~/.config/containers /etc/containers
132
+
cat > ~/.config/containers/policy.json << EOF
133
+
{
134
+
"default": [
135
+
{
136
+
"type": "insecureAcceptAnything"
137
+
}
138
+
],
139
+
"transports": {
140
+
"docker-daemon": {
141
+
"": [
142
+
{
143
+
"type": "insecureAcceptAnything"
144
+
}
145
+
]
146
+
}
147
+
}
148
+
}
149
+
EOF
150
+
cp ~/.config/containers/policy.json /etc/containers/policy.json 2>/dev/null || true
151
+
152
+
echo "Exporting buildah images to Docker format..."
153
+
buildah push localhost/$DOCKER_USERNAME/$DOCKER_REPO:$TAG docker-archive:image-$TAG.tar || {
154
+
echo "Failed to export $TAG image"
155
+
exit 1
156
+
}
157
+
buildah push localhost/$DOCKER_USERNAME/$DOCKER_REPO:latest docker-archive:image-latest.tar || {
158
+
echo "Failed to export latest image"
159
+
exit 1
160
+
}
161
0
162
echo "Logging in to Docker Hub..."
163
+
echo "$DOCKER_PASSWORD" | skopeo login docker.io -u "$DOCKER_USERNAME" --password-stdin || {
164
+
echo "Failed to login to Docker Hub"
165
+
exit 1
166
+
}
167
168
echo "Pushing image: $DOCKER_USERNAME/$DOCKER_REPO:$TAG"
169
170
# Push the tagged image
171
skopeo copy \
172
docker-archive:image-$TAG.tar \
173
+
docker://docker.io/$DOCKER_USERNAME/$DOCKER_REPO:$TAG || {
174
+
echo "Failed to push $TAG image"
175
+
exit 1
176
+
}
177
178
# Push as latest
179
skopeo copy \
180
docker-archive:image-latest.tar \
181
+
docker://docker.io/$DOCKER_USERNAME/$DOCKER_REPO:latest || {
182
+
echo "Failed to push latest image"
183
+
exit 1
184
+
}
185
186
+
echo "Successfully pushed both $TAG and latest tags to Docker Hub"
187
188
environment:
189
GIT_COMMIT: "${CI_COMMIT_SHA}"