Create image replacement that is compatible with current act
This commit is contained in:
@@ -9,7 +9,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
act-base:
|
act-base:
|
||||||
name: Build docker images for act
|
name: Build base docker images for act
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -17,7 +17,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
DISTRIB_ID: [ubuntu]
|
DISTRIB_ID: [ubuntu]
|
||||||
DISTRIB_RELEASE: [latest, 20.04, 18.04, 16.04]
|
DISTRIB_RELEASE: [latest, 20.04, 18.04, 16.04]
|
||||||
IMAGE_TYPE: [nodejs]
|
IMAGE_TYPE: [nodejs, runner]
|
||||||
NODE_VERSION: ['12']
|
NODE_VERSION: ['12']
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|||||||
@@ -2,7 +2,13 @@
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
- `\linux\ubuntu\nodejs\Dockerfile` - used as base image for [github.com/catthehacker/act](https://github.com/catthehacker/act)
|
- `\linux\ubuntu\runner\Dockerfile` - used as base image for [github.com/catthehacker/act](https://github.com/catthehacker/act)
|
||||||
|
- ghcr.io (GitHub Container Registry)
|
||||||
|
- `ghcr.io/catthehacker/docker-images:ubuntu-runner-16.04`
|
||||||
|
- `ghcr.io/catthehacker/docker-images:ubuntu-runner-18.04`
|
||||||
|
- `ghcr.io/catthehacker/docker-images:ubuntu-runner-20.04`
|
||||||
|
- `ghcr.io/catthehacker/docker-images:ubuntu-runner-latest`
|
||||||
|
- `\linux\ubuntu\nodejs\Dockerfile` - proposal for [github.com/nektos/act](https://github.com/nektos/act) as base image before support for above image is implemented
|
||||||
- ghcr.io (GitHub Container Registry)
|
- ghcr.io (GitHub Container Registry)
|
||||||
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-16.04`
|
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-16.04`
|
||||||
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-18.04`
|
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-18.04`
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ FROM ${DISTRIB_ID}:${DISTRIB_RELEASE}
|
|||||||
ARG DISTRIB_ID=ubuntu
|
ARG DISTRIB_ID=ubuntu
|
||||||
ARG DISTRIB_RELEASE=20.04
|
ARG DISTRIB_RELEASE=20.04
|
||||||
|
|
||||||
# > non-root user
|
|
||||||
ARG RUNNER_USER=runner
|
|
||||||
|
|
||||||
# > Node version
|
# > Node version
|
||||||
ARG NODE_VERSION=12
|
ARG NODE_VERSION=12
|
||||||
|
|
||||||
@@ -17,26 +14,30 @@ ARG DEBIAN_FRONTEND=noninteractive
|
|||||||
|
|
||||||
SHELL [ "/bin/bash", "-c" ]
|
SHELL [ "/bin/bash", "-c" ]
|
||||||
|
|
||||||
# > Install base binutils and dependencies, setup environment required for GitHub Actions
|
# > setup environment required for GitHub Actions
|
||||||
RUN set -Eeuxo pipefail && \
|
RUN set -Eeuxo pipefail && \
|
||||||
|
printf "Build started" && \
|
||||||
ImageOS=${DISTRIB_ID}$(echo ${DISTRIB_RELEASE} | cut -d'.' -f 1) && \
|
ImageOS=${DISTRIB_ID}$(echo ${DISTRIB_RELEASE} | cut -d'.' -f 1) && \
|
||||||
echo "IMAGE_OS=$ImageOS" | tee -a /etc/environment && \
|
echo "IMAGE_OS=$ImageOS" | tee -a /etc/environment && \
|
||||||
echo "ImageOS=$ImageOS" | tee -a /etc/environment && \
|
echo "ImageOS=$ImageOS" | tee -a /etc/environment && \
|
||||||
echo "LSB_RELEASE=${DISTRIB_RELEASE}" | tee -a /etc/environment && \
|
echo "LSB_RELEASE=${DISTRIB_RELEASE}" | tee -a /etc/environment && \
|
||||||
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache && \
|
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache && \
|
||||||
echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment && \
|
echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment && \
|
||||||
echo "RUNNER_USER=${RUNNER_USER}" | tee -a /etc/environment && \
|
|
||||||
echo "RUNNER_TEMP=/home/${RUNNER_USER}/work/_temp" | tee -a /etc/environment && \
|
|
||||||
echo "RUN_TOOL_CACHE=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment && \
|
echo "RUN_TOOL_CACHE=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment && \
|
||||||
echo "DEPLOYMENT_BASEPATH=/opt/runner" | tee -a /etc/environment && \
|
echo "DEPLOYMENT_BASEPATH=/opt/runner" | tee -a /etc/environment && \
|
||||||
echo ". /etc/environment" | tee -a /etc/profile && \
|
echo ". /etc/environment" | tee -a /etc/profile && \
|
||||||
mkdir -p $AGENT_TOOLSDIRECTORY && \
|
mkdir -p $AGENT_TOOLSDIRECTORY && \
|
||||||
chown 1000:1000 $AGENT_TOOLSDIRECTORY && \
|
chown 1000:1000 $AGENT_TOOLSDIRECTORY && \
|
||||||
chmod 0777 $AGENT_TOOLSDIRECTORY && \
|
chmod 0777 $AGENT_TOOLSDIRECTORY && \
|
||||||
printf "Build started" && \
|
mkdir -p /github && \
|
||||||
|
chown 1000:1000 /github && \
|
||||||
|
chmod 0777 /github
|
||||||
|
|
||||||
|
# > Install deps
|
||||||
|
RUN set -Eeuxo pipefail && \
|
||||||
apt -yq update && \
|
apt -yq update && \
|
||||||
printf "Updated apt lists and upgraded packages\n\n" && \
|
printf "Updated apt lists and upgraded packages\n\n" && \
|
||||||
apt -yq install --no-install-recommends lsb-release gawk jq curl git wget sudo gnupg-agent ca-certificates software-properties-common apt-transport-https && \
|
apt -yq install --no-install-recommends ssh lsb-release gawk jq curl git wget sudo gnupg-agent ca-certificates software-properties-common apt-transport-https libyaml-0-2 && \
|
||||||
printf "Installed base utils"
|
printf "Installed base utils"
|
||||||
|
|
||||||
# > Install Node.JS
|
# > Install Node.JS
|
||||||
@@ -58,27 +59,10 @@ RUN set -Eeuxo pipefail && \
|
|||||||
rm -rf /tmp/* && \
|
rm -rf /tmp/* && \
|
||||||
printf "Cleaned up image"
|
printf "Cleaned up image"
|
||||||
|
|
||||||
# > Create non-root user
|
|
||||||
RUN set -Eeuxo pipefail && \
|
|
||||||
printf "Creating non-root user" && \
|
|
||||||
groupadd -g 1000 ${RUNNER_USER} && \
|
|
||||||
useradd -u 1000 -g ${RUNNER_USER} -G sudo -m -s /bin/bash ${RUNNER_USER} && \
|
|
||||||
sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' && \
|
|
||||||
sed -i /etc/sudoers -re 's/^root.*/root ALL=(ALL:ALL) NOPASSWD: ALL/g' && \
|
|
||||||
sed -i /etc/sudoers -re 's/^#includedir.*/## **Removed the include directive** ##"/g' && \
|
|
||||||
echo "${RUNNER_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
|
|
||||||
echo "runner user: $(su - ${RUNNER_USER} -c id)" && \
|
|
||||||
printf "Created non-root user $(grep ${RUNNER_USER} /etc/passwd)"
|
|
||||||
|
|
||||||
# > Home repository
|
# > Home repository
|
||||||
LABEL org.opencontainers.image.source="https://github.com/CatTheHacker/docker-images"
|
LABEL org.opencontainers.image.source="https://github.com/CatTheHacker/docker-images"
|
||||||
|
|
||||||
# > Don't run as root, generally not good idea
|
|
||||||
USER ${RUNNER_USER}:${RUNNER_USER}
|
|
||||||
|
|
||||||
SHELL [ "/bin/bash", "--login" ]
|
SHELL [ "/bin/bash", "--login" ]
|
||||||
|
|
||||||
WORKDIR /home/runner
|
|
||||||
|
|
||||||
# > Force bash with environment
|
# > Force bash with environment
|
||||||
ENTRYPOINT [ "/bin/bash", "--login" ]
|
ENTRYPOINT [ "/bin/bash", "--login" ]
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
ARG DISTRIB_ID=ubuntu
|
||||||
|
ARG DISTRIB_RELEASE=20.04
|
||||||
|
FROM ${DISTRIB_ID}:${DISTRIB_RELEASE}
|
||||||
|
|
||||||
|
# > ARGs before FROM are not accessible
|
||||||
|
ARG DISTRIB_ID=ubuntu
|
||||||
|
ARG DISTRIB_RELEASE=20.04
|
||||||
|
|
||||||
|
# > non-root user
|
||||||
|
ARG RUNNER_USER=runner
|
||||||
|
|
||||||
|
# > Node version
|
||||||
|
ARG NODE_VERSION=12
|
||||||
|
|
||||||
|
# > Force apt to not be interactive/not ask
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
SHELL [ "/bin/bash", "-c" ]
|
||||||
|
|
||||||
|
# > Install base binutils and dependencies, setup environment required for GitHub Actions
|
||||||
|
RUN set -Eeuxo pipefail && \
|
||||||
|
ImageOS=${DISTRIB_ID}$(echo ${DISTRIB_RELEASE} | cut -d'.' -f 1) && \
|
||||||
|
echo "IMAGE_OS=$ImageOS" | tee -a /etc/environment && \
|
||||||
|
echo "ImageOS=$ImageOS" | tee -a /etc/environment && \
|
||||||
|
echo "LSB_RELEASE=${DISTRIB_RELEASE}" | tee -a /etc/environment && \
|
||||||
|
AGENT_TOOLSDIRECTORY=/opt/hostedtoolcache && \
|
||||||
|
echo "AGENT_TOOLSDIRECTORY=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment && \
|
||||||
|
echo "RUNNER_USER=${RUNNER_USER}" | tee -a /etc/environment && \
|
||||||
|
echo "RUNNER_TEMP=/home/${RUNNER_USER}/work/_temp" | tee -a /etc/environment && \
|
||||||
|
echo "RUN_TOOL_CACHE=$AGENT_TOOLSDIRECTORY" | tee -a /etc/environment && \
|
||||||
|
echo "DEPLOYMENT_BASEPATH=/opt/runner" | tee -a /etc/environment && \
|
||||||
|
echo ". /etc/environment" | tee -a /etc/profile && \
|
||||||
|
mkdir -p $AGENT_TOOLSDIRECTORY && \
|
||||||
|
chown 1000:1000 $AGENT_TOOLSDIRECTORY && \
|
||||||
|
chmod 0777 $AGENT_TOOLSDIRECTORY && \
|
||||||
|
mkdir -p /github && \
|
||||||
|
chown 1000:1000 /github && \
|
||||||
|
chmod 0777 /github && \
|
||||||
|
printf "Build started" && \
|
||||||
|
apt -yq update && \
|
||||||
|
printf "Updated apt lists and upgraded packages\n\n" && \
|
||||||
|
apt -yq install --no-install-recommends lsb-release gawk jq curl git wget sudo gnupg-agent ca-certificates software-properties-common apt-transport-https && \
|
||||||
|
printf "Installed base utils"
|
||||||
|
|
||||||
|
# > Install Node.JS
|
||||||
|
RUN set -Eeuxo pipefail && \
|
||||||
|
printf "Installing Node.JS" && \
|
||||||
|
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
|
||||||
|
DISTRO="$(lsb_release -s -c)" && \
|
||||||
|
echo "deb https://deb.nodesource.com/node_${NODE_VERSION}.x $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list && \
|
||||||
|
echo "deb-src https://deb.nodesource.com/node_${NODE_VERSION}.x $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list && \
|
||||||
|
apt -yq update && \
|
||||||
|
apt -yq install --no-install-recommends nodejs="${NODE_VERSION}*" && \
|
||||||
|
printf "Installed Node.JS $(node -v)"
|
||||||
|
|
||||||
|
# > Clean up image
|
||||||
|
RUN set -Eeuxo pipefail && \
|
||||||
|
printf "Cleaning image" && \
|
||||||
|
apt-get clean && \
|
||||||
|
rm -rf /var/lib/apt/lists/* && \
|
||||||
|
rm -rf /tmp/* && \
|
||||||
|
printf "Cleaned up image"
|
||||||
|
|
||||||
|
# > Create non-root user
|
||||||
|
RUN set -Eeuxo pipefail && \
|
||||||
|
printf "Creating non-root user" && \
|
||||||
|
groupadd -g 1000 ${RUNNER_USER} && \
|
||||||
|
useradd -u 1000 -g ${RUNNER_USER} -G sudo -m -s /bin/bash ${RUNNER_USER} && \
|
||||||
|
sed -i /etc/sudoers -re 's/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD: ALL/g' && \
|
||||||
|
sed -i /etc/sudoers -re 's/^root.*/root ALL=(ALL:ALL) NOPASSWD: ALL/g' && \
|
||||||
|
sed -i /etc/sudoers -re 's/^#includedir.*/## **Removed the include directive** ##"/g' && \
|
||||||
|
echo "${RUNNER_USER} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
|
||||||
|
echo "runner user: $(su - ${RUNNER_USER} -c id)" && \
|
||||||
|
printf "Created non-root user $(grep ${RUNNER_USER} /etc/passwd)"
|
||||||
|
|
||||||
|
# > Home repository
|
||||||
|
LABEL org.opencontainers.image.source="https://github.com/CatTheHacker/docker-images"
|
||||||
|
|
||||||
|
# > Don't run as root, generally not good idea
|
||||||
|
USER ${RUNNER_USER}:${RUNNER_USER}
|
||||||
|
|
||||||
|
SHELL [ "/bin/bash", "--login" ]
|
||||||
|
|
||||||
|
WORKDIR /home/runner
|
||||||
|
|
||||||
|
# > Force bash with environment
|
||||||
|
ENTRYPOINT [ "/bin/bash", "--login" ]
|
||||||
Reference in New Issue
Block a user