Fix Dockerfile
This commit is contained in:
parent
cb6d0705e5
commit
fa0749ae81
12
Dockerfile
12
Dockerfile
@ -1,14 +1,14 @@
|
|||||||
FROM alpine:3.19
|
FROM alpine:3.19
|
||||||
|
|
||||||
|
# התקנת כלים שאתה צריך
|
||||||
RUN apk add --no-cache bash git yq curl
|
RUN apk add --no-cache bash git yq curl
|
||||||
|
|
||||||
# workaround: הורדה ל־/tmp ואז העברה
|
# הורדת Kaniko למיקום יציב
|
||||||
RUN mkdir -p /kaniko && \
|
RUN curl -sSL -o /usr/local/bin/kaniko \
|
||||||
curl -sSL https://github.com/GoogleContainerTools/kaniko/releases/download/v1.21.0/executor -o /tmp/executor && \
|
https://github.com/GoogleContainerTools/kaniko/releases/download/v1.21.0/executor && \
|
||||||
mv /tmp/executor /kaniko/executor && \
|
chmod +x /usr/local/bin/kaniko
|
||||||
chmod +x /kaniko/executor
|
|
||||||
|
|
||||||
ENV PATH="/kaniko:$PATH"
|
ENV PATH="/usr/local/bin:$PATH"
|
||||||
|
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|||||||
@ -6,7 +6,8 @@ echo "🚀 Starting wp-kaniko-sync"
|
|||||||
TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}"
|
TAG="${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:7}"
|
||||||
echo "🧩 Using tag: $TAG"
|
echo "🧩 Using tag: $TAG"
|
||||||
|
|
||||||
/kaniko/executor \
|
echo "🔨 Building Docker image for ${PLUGIN_CONTEXT}"
|
||||||
|
kaniko \
|
||||||
--dockerfile="${PLUGIN_DOCKERFILE}" \
|
--dockerfile="${PLUGIN_DOCKERFILE}" \
|
||||||
--context="${PLUGIN_CONTEXT}" \
|
--context="${PLUGIN_CONTEXT}" \
|
||||||
--destination="${PLUGIN_REGISTRY}/${PLUGIN_REPO}:${TAG}" \
|
--destination="${PLUGIN_REGISTRY}/${PLUGIN_REPO}:${TAG}" \
|
||||||
@ -18,14 +19,20 @@ echo "🧩 Using tag: $TAG"
|
|||||||
echo "✅ Image pushed successfully"
|
echo "✅ Image pushed successfully"
|
||||||
|
|
||||||
if [[ -n "$PLUGIN_GIT_REPO" ]]; then
|
if [[ -n "$PLUGIN_GIT_REPO" ]]; then
|
||||||
|
echo "📡 Cloning GitOps repo"
|
||||||
|
|
||||||
git config --global user.name "woodpecker-bot"
|
git config --global user.name "woodpecker-bot"
|
||||||
git config --global user.email "ci@dvirlabs.com"
|
git config --global user.email "ci@dvirlabs.com"
|
||||||
|
|
||||||
git clone "https://${PLUGIN_GIT_USERNAME}:${PLUGIN_GIT_TOKEN}@${PLUGIN_GIT_REPO}"
|
git clone "https://${PLUGIN_GIT_USERNAME}:${PLUGIN_GIT_TOKEN}@${PLUGIN_GIT_REPO}"
|
||||||
cd $(basename "$PLUGIN_GIT_REPO" .git)
|
cd $(basename "$PLUGIN_GIT_REPO" .git)
|
||||||
|
|
||||||
|
echo "📝 Updating tag in ${PLUGIN_VALUES_FILE}"
|
||||||
yq -i ".$PLUGIN_VALUES_PATH = \"$TAG\"" "$PLUGIN_VALUES_FILE"
|
yq -i ".$PLUGIN_VALUES_PATH = \"$TAG\"" "$PLUGIN_VALUES_FILE"
|
||||||
|
|
||||||
git add "$PLUGIN_VALUES_FILE"
|
git add "$PLUGIN_VALUES_FILE"
|
||||||
git commit -m "${PLUGIN_NAME}: update tag to $TAG" || echo "⚠️ No changes"
|
git commit -m "${PLUGIN_NAME}: update tag to $TAG" || echo "⚠️ No changes"
|
||||||
git push origin HEAD
|
git push origin HEAD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "🎉 Done"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user