docker-scripts/linux/ecosystem/gitlab/runner/latest/Dockerfile

79 lines
3.1 KiB
Docker
Raw Normal View History

2024-06-21 16:10:08 +03:00
FROM epicmorg/debian:bookworm-develop
2022-11-14 22:12:31 +03:00
LABEL maintainer="EpicMorg DevTeam, developer@epicm.org"
ARG DEBIAN_FRONTEND=noninteractive
2024-06-21 16:10:08 +03:00
ENV GITLAB_RUNNER_HOME=/home/gitlab-runner
2022-11-14 22:12:31 +03:00
ENV GITLAB_RUNNER_CONF=/etc/gitlab-runner
ENV GIT_SSH_VARIANT=ssh
RUN mkdir -p ${GITLAB_RUNNER_HOME} ${GITLAB_RUNNER_CONF} ${GITLAB_RUNNER_CONF}/certs && \
chmod -R 700 /etc/gitlab-runner
##################################################################
# docker setup
##################################################################
#Install packages
2024-12-05 18:24:33 +03:00
RUN install -m 0755 -d /etc/apt/keyrings && \
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc && \
chmod a+r /etc/apt/keyrings/docker.asc && \
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian bookworm stable nightly" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
2022-11-14 22:12:31 +03:00
apt-get update && \
apt-get install -y --no-install-recommends --allow-unauthenticated \
docker-ce \
docker-ce-cli \
2024-12-05 18:24:33 +03:00
containerd.io \
docker-buildx-plugin \
docker-compose-plugin \
systemd && \
2022-11-14 22:12:31 +03:00
systemctl disable docker && \
docker --version
COPY run-docker.sh /services/run-docker.sh
RUN chmod +x /services/run-docker.sh && \
sync
##################################################################
# docker compose setup
##################################################################
#Install packages
RUN export DOCKER_COMPOSE_VERSION=`curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r` && \
echo "Latest compose is: ${DOCKER_COMPOSE_VERSION}" && \
curl -SL https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-Linux-x86_64 -o /usr/local/bin/docker-compose && \
chmod +x /usr/local/bin/docker-compose && \
docker-compose --version
##################################################################
# gitlab runner setup
##################################################################
2024-12-05 18:24:33 +03:00
ADD https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb /tmp
RUN dpkg -i /tmp/gitlab-runner_amd64.deb && \
2022-11-14 22:12:31 +03:00
usermod -aG docker gitlab-runner && \
cat /etc/passwd && \
gitlab-runner --version
##################################################################
# cleaninig up
##################################################################
RUN apt clean -y && \
apt-get clean all && \
apt autoclean -y && \
rm -rfv /var/lib/apt/lists/* && \
2024-12-10 01:21:19 +03:00
rm -rfv /var/cache/apt/* && \
2024-12-10 01:08:00 +03:00
rm -rfv /root/tmp/* && \
2022-11-14 22:12:31 +03:00
rm -rfv /tmp/*
#Final config
STOPSIGNAL SIGQUIT
2024-06-21 16:10:08 +03:00
VOLUME ["${GITLAB_RUNNER_CONF}", "/home/gitlab-runner", "/var/lib/docker"]
WORKDIR /home/gitlab-runner
2022-11-14 22:12:31 +03:00
# Add image configuration and scripts
COPY docker-entrypoint.sh /usr/bin/docker-entrypoint.sh
RUN chmod 755 /usr/bin/docker-entrypoint.sh
2024-07-28 01:48:50 +03:00
RUN updatedb
2022-11-14 22:12:31 +03:00
ENTRYPOINT ["/usr/bin/dumb-init", "docker-entrypoint.sh"]
2024-06-21 16:10:08 +03:00
CMD ["run", "--user=gitlab-runner", "--working-directory=/home/gitlab-runner"]