docker-scripts/linux/ecosystem/gitlab/runner/php7.4/Dockerfile

86 lines
3.3 KiB
Docker
Raw Normal View History

2022-11-14 22:44:11 +03:00
FROM epicmorg/php:php7.4
LABEL maintainer="EpicMorg DevTeam, developer@epicm.org"
ARG DEBIAN_FRONTEND=noninteractive
##################################################################
# php
##################################################################
RUN php -m && \
php -v
2024-06-21 16:10:08 +03:00
ENV GITLAB_RUNNER_HOME=/home/gitlab-runner
2022-11-14 22:44:11 +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
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - && \
2024-06-21 16:10:08 +03:00
echo 'deb https://download.docker.com/linux/debian bookworm test' > /etc/apt/sources.list.d/docker.list && \
echo 'deb https://download.docker.com/linux/debian bookworm nightly' >> /etc/apt/sources.list.d/docker.list && \
2022-11-14 22:44:11 +03:00
apt-cache policy docker-ce && \
apt-get update && \
apt-get install -y --no-install-recommends --allow-unauthenticated \
docker-ce \
docker-ce-cli \
containerd.io systemd && \
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
##################################################################
COPY install-gitlab-runner.sh /tmp/install-gitlab-runner.sh
RUN cd /tmp && \
chmod +x /tmp/install-gitlab-runner.sh && \
bash /tmp/install-gitlab-runner.sh && \
# useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash && \
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:44:11 +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:44:11 +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:44:11 +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"]
2022-11-14 22:44:11 +03:00