I wrote custom gitlab-runner in docker, for using my own app in gitlab pipline my Dockerfile:
FROM node:14 as node
FROM gitlab/gitlab-runner:latest
USER root
#PYTHON
RUN apt update && apt install -y python3 python3-pip python3-venv
#make venv
ENV PATH="/opt/venv/bin:$PATH"
RUN python3 -m venv /opt/venv
COPY . /opt/delta_bot/
RUN pip3 install -r /opt/delta_bot/req.txt
RUN mv /opt/delta_bot/req.txt /tmp
#copy delta deploy bot
#Node
COPY --from=node /usr/local/lib/ /usr/local/lib/
COPY --from=node /usr/local/bin/ /usr/local/bin/
# RUN wget https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.53.0/pmd-bin-6.53.0.zip
RUN apt update && apt install -y zip
RUN wget -P /tmp/ https://github.com/pmd/pmd/releases/download/pmd_releases%2F6.53.0/pmd-bin-6.53.0.zip
# ADD pmd-bin-6.53.0.zip /tmp/
RUN unzip /tmp/pmd-bin-6.53.0.zip -d /opt/pmd/
RUN alias pmd="/opt/pmd/pmd-bin-6.53.0/bin"
RUN mkdir /opt/for_analys/
# Install: sfdx cli, sfdx plugins, curl, jq
ENV DEBIAN_FRONTEND=noninteractive
ARG SALESFORCE_CLI_VERSION=latest
RUN apt-get update
ENV PATH=/usr/local/lib/nodejs/bin:$PATH
RUN npm install --global sfdx-cli@${SALESFORCE_CLI_VERSION}
RUN apt-get install --assume-yes \
openjdk-11-jdk-headless \
jq
RUN apt-get autoremove --assume-yes \
&& apt-get clean --assume-yes \
&& rm -rf /var/lib/apt/lists/*
ENV SFDX_CONTAINER_MODE true
ENV DEBIAN_FRONTEND=dialog
ENV SHELL /bin/bash
RUN rm -rf /tmp/*
VOLUME /srv/delta_bot/jsons /opt/delta_bot/jsons
VOLUME /srv/delta_bot/errors /opt/delta_bot/errors
VOLUME /srv/auth/ /root/auth
#MAINTAINER skibenko113@gmail.com
LABEL version="1.1"
If I run my app inside container by following command
sudo docker run -it --entrypoint bash miekrif/delta_bot
all be right
If I run it like gitlab-runner I met following failure:
Getting source from Git repository
error: could not lock config file /opt/delta_bot/.gitconfig: No such file or directory
But I don't mark /opt/delta_bot like workdir
gitlab-runner config:
[[runners]]
token_obtained_at = 2023-01-24T11:11:18Z
token_expires_at = 0001-01-01T00:00:00Z
executor = "docker"
[runners.custom_build_dir]
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "ruby:2.7"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
All this needs for our CI to several env, Python app inside verified and work, also it work outside pipline in docker, but I met this problem and can't understood what need to do
Problem was resolved it has been in variables a .gitlab-ci.yml
HOME: "/opt/delta_bot"
it should named another name, because variable $HOME its native variables in Giltab