Skip to content
Snippets Groups Projects
Commit 7a6fe7c9 authored by istmxrein's avatar istmxrein
Browse files

refactor Dockerfile

- use python docker image
- download gitlab-runner from binary
parent c401ffa6
No related branches found
No related tags found
No related merge requests found
FROM python:3-slim
ARG GITLAB_RUNNER_VERSION=v15.2.1
ENV GITLAB_RUNNER_URL="https://gitlab-runner-downloads.s3.amazonaws.com/${GITLAB_RUNNER_VERSION}/binaries/gitlab-runner-linux-amd64"
LABEL maintainer="Max Reinheimer <max@reinheimer.dev>" \
io.openshift.tags="gitlab,ci,runner" \
name="openstack-gitlab-runner" \
io.k8s.display-name="GitLab runner" \
summary="GitLab runner" \
description="A GitLab runner image with openstack custom executor." \
io.k8s.description="A GitLab runner image with openstack custom executor."
COPY cleanup.py env.py config.sh prepare.py run.py requirements.txt /data/
COPY entrypoint.sh /usr/bin/entrypoint
RUN apt-get update && apt-get -y install curl dumb-init gcc libffi-dev && \
curl -L --output /usr/bin/gitlab-runner "${GITLAB_RUNNER_URL}" && \
pip3 install -r /data/requirements.txt && \
chmod +x /data/* /usr/bin/entrypoint /usr/bin/gitlab-runner && \
useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash && \
apt-get remove -y gcc curl && apt autoremove && apt-get clean
USER gitlab-runner
WORKDIR /data
ENTRYPOINT ["dumb-init", "--"]
CMD ["entrypoint"]
......@@ -16,13 +16,13 @@ echo "$PRIVATE_KEY" > "$HOME"/priv_key
gitlab-runner register --non-interactive \
--executor=custom \
--custom-config-exec="$HOME"/config.sh \
--custom-prepare-exec="$HOME"/prepare.py \
--custom-run-exec="$HOME"/run.py \
--custom-cleanup-exec="$HOME"/cleanup.py
--custom-config-exec=/data/config.sh \
--custom-prepare-exec=/data/prepare.py \
--custom-run-exec=/data/run.py \
--custom-cleanup-exec=/data/cleanup.py
if [[ "$CONCURRENT" ]]; then
sed -i "s/concurrent = .*/concurrent = $CONCURRENT/g" "$HOME"/.gitlab-runner/config.toml
sed -i "s/concurrent = .*/concurrent = $CONCURRENT/g" $HOME/.gitlab-runner/config.toml
fi
gitlab-runner run
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment