@@ -2,7 +2,8 @@ FROM ubuntu:20.04
22
33ARG UBUNTU_VERSION=20.04
44ARG DEBIAN_FRONTEND=noninteractive
5- ARG PACKAGES="libffi-dev libicu-dev build-essential libssl-dev ca-certificates software-properties-common jq sed grep git curl wget zip ansible python3-pip"
5+ ARG PACKAGES_BASE="libffi-dev libicu-dev build-essential libssl-dev ca-certificates software-properties-common curl"
6+ ARG PACKAGES_ADDITIONAL="jq sed grep git wget zip ansible python3-pip nodejs"
67ARG PACKAGES_PYTHON="kubernetes"
78
89ENV USERNAME="runner"
@@ -11,7 +12,7 @@ ENV UBUNTU_VERSION=20.04
1112
1213ENV HOME="/home/$USERNAME"
1314ENV RUNNER_HOME="/home/$USERNAME/runner"
14- ENV USER_TMP_DIR=/home/$USERNAME/tmp
15+ ENV USER_TMP_DIR=" /home/$USERNAME/tmp"
1516
1617ENV GH_RUNNER_WORKDIR="/home/$USERNAME"
1718ENV GH_KANIKO_WORKDIR="/kaniko/workspace"
@@ -28,29 +29,31 @@ ENV ALPACA_VERSION 1.3.2
2829# making nessecarry directories
2930RUN mkdir /helper-scripts \
3031 && mkdir -p /kaniko/workspace \
31- && mkdir /run/user/$USERID \
32- && mkdir $USER_TMP_DIR
32+ && mkdir -p $USER_TMP_DIR \
33+ && mkdir -p $RUNNER_HOME \
34+ && mkdir -p $HOME/.ansible \
35+ && mkdir -p /run/user/$USERID
3336
3437# Copy image helper scripts
3538ADD ./helper-scripts/ /helper-scripts/
3639
3740RUN chmod -R 755 /helper-scripts
3841
42+ RUN apt-get update \
43+ && apt-get install -y $PACKAGES_BASE \
44+ && rm -rf /var/lib/apt/lists/* \
45+ && apt-get clean
46+
3947# # ansible keys
40- RUN wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | apt-key add - \
48+ RUN curl -fsSL https://packages.adoptium.net/artifactory/api/gpg/key/public | apt-key add - \
4149 && echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
4250
4351# install packages along with jq so we can parse JSON
4452# add additional packages as necessary
4553RUN apt-get update \
4654 && add-apt-repository -y --update ppa:ansible/ansible \
4755 && curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - \
48- && apt-get install -y ${PACKAGES} \
49- && rm -rf /var/lib/apt/lists/* \
50- && apt-get clean
51-
52- # install nodejs
53- RUN apt-get install -y nodejs \
56+ && apt-get install -y $PACKAGES_ADDITIONAL \
5457 && rm -rf /var/lib/apt/lists/* \
5558 && apt-get clean
5659
@@ -67,16 +70,15 @@ RUN curl -L -O https://github.com/samuong/alpaca/releases/download/v${ALPACA_VER
6770 && chmod +x /usr/local/src/alpaca \
6871 && ln -s /usr/local/src/alpaca /usr/local/bin/
6972
70- COPY requirements.yml ${TMP_DIR}/requirements.yml
71-
7273WORKDIR /home/${USERNAME}/runner
7374
7475# add a non-sudo user
7576RUN useradd -m -u $USERID $USERNAME \
7677 && usermod -aG sudo $USERNAME \
7778 && chown -R $USERNAME $GH_RUNNER_WORKDIR \
78- && chown -R $USERNAME $GH_KANIKO_WORKDIR \
79- && mkdir -p ${RUNNER_HOME}
79+ && chown -R $USERNAME $GH_KANIKO_WORKDIR
80+
81+ COPY requirements.yml $USER_TMP_DIR/requirements.yml
8082
8183# Install github runner
8284RUN export ARCH=$(/helper-scripts/translate-aarch.sh x-short) \
@@ -89,7 +91,6 @@ RUN export ARCH=$(/helper-scripts/translate-aarch.sh x-short) \
8991
9092# chown userscoped directories
9193RUN chown -R $USERNAME $HOME \
92- && mkdir $HOME/.ansible \
9394 && chown -R $USERNAME /run/user/$USERID
9495
9596# set the entrypoint to the entrypoint.sh script
@@ -99,4 +100,4 @@ USER $USERNAME
99100
100101RUN pip3 install $PACKAGES_PYTHON --user
101102# RUN ansible-galaxy install -c -r ${TMP_DIR}/requirements.yml
102- RUN ansible-galaxy collection install -c -r ${TMP_DIR} /requirements.yml
103+ RUN ansible-galaxy collection install -c -r $USER_TMP_DIR /requirements.yml
0 commit comments