Initial repo

This commit is contained in:
hackercat
2021-01-12 15:18:54 +00:00
commit 93b0b305de
3 changed files with 112 additions and 0 deletions
+61
View File
@@ -0,0 +1,61 @@
name: Daily build
on:
schedule:
- cron: 0 0 * * *
push:
pull_request:
jobs:
act-base:
name: Build docker images for act
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
DISTRIB_ID: [ubuntu]
DISTRIB_RELEASE: [16.04, 18.04, 20.04, latest]
PLATFORMS: [linux/amd64, linux/arm64, linux/386]
IMAGE_TYPE: [nodejs]
exclude:
- DISTRIB_RELEASE: 20.04 # focal i386 doesn't exists (yet?)
PLATFORMS: linux/386
steps:
- uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Log into ghcr
if: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u catthehacker --password-stdin
- name: Check which version is currently `ubuntu-latest`
id: ubuntu_latest
if: ${{ matrix.DISTRIB_RELEASE == 'latest' }}
run: echo "::set-output name=UBUNTU_LATEST::$(lsb_release -sr)"
- name: Build and push ${{ matrix.DISTRIB_ID }}-${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} image
id: docker_build_version
uses: docker/build-push-action@v2
if: ${{ matrix.DISTRIB_RELEASE != 'latest' }}
with:
context: .
push: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
file: ./linux/${{ matrix.DISTRIB_ID }}/${{ matrix.IMAGE_TYPE }}/Dockerfile
platforms: ${{ matrix.PLATFORMS }}
tags: ghcr.io/catthehacker/docker-images:${{ matrix.DISTRIB_ID }}-${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}
build-args: |
DISTRIB_ID=${{ matrix.DISTRIB_ID }}
DISTRIB_RELEASE=${{ matrix.DISTRIB_RELEASE }}
- name: Build and push ${{ matrix.DISTRIB_ID }}-${{ matrix.IMAGE_TYPE }}-latest image
id: docker_build_latest
uses: docker/build-push-action@v2
if: ${{ matrix.DISTRIB_RELEASE == 'latest' }}
with:
context: .
push: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
file: ./linux/${{ matrix.DISTRIB_ID }}/${{ matrix.IMAGE_TYPE }}/Dockerfile
platforms: ${{ matrix.PLATFORMS }}
tags: ghcr.io/catthehacker/docker-images:${{ matrix.DISTRIB_ID }}-${{ matrix.IMAGE_TYPE }}-latest
build-args: |
DISTRIB_ID=${{ matrix.DISTRIB_ID }}
DISTRIB_RELEASE=${{ steps.ubuntu_latest.outputs.UBUNTU_LATEST }}
+10
View File
@@ -0,0 +1,10 @@
# Docker images
![Daily build](https://github.com/CatTheHacker/docker-images/workflows/Daily%20build/badge.svg)
- `\linux\ubuntu\nodejs\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-nodejs-16.04`
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-18.04`
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-20.04`
- `ghcr.io/catthehacker/docker-images:ubuntu-nodejs-latest`
+41
View File
@@ -0,0 +1,41 @@
ARG DISTRIB_ID=ubuntu
ARG DISTRIB_RELEASE=20.04
FROM ${DISTRIB_ID}:${DISTRIB_RELEASE}
# non-root user
ARG RUNNER_USER=runner
# force apt
ARG DEBIAN_FRONTEND=noninteractive
# Install dependencies and create non-root user with sudo permissions
RUN apt -yq update && \
apt -yq upgrade && \
apt -yq install curl git wget sudo gnupg apt-transport-https openssl && \
apt -yq install --no-install-recommends lsb-release gawk jq && \
curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add - && \
DISTRO="$(lsb_release -s -c)" && \
echo "deb https://deb.nodesource.com/node_12.x $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list && \
echo "deb-src https://deb.nodesource.com/node_12.x $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list && \
apt -yq update && \
apt -yq upgrade && \
apt -yq install nodejs && \
apt-get clean && \
rm -rf /tmp/* && \
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 "Customized the sudoers file for passwordless access to the ${RUNNER_USER} user!" && \
echo "runner user:"; su - ${RUNNER_USER} -c id
# Home repository
LABEL repository="https://github.com/catthehacker/docker-images"
# Don't run as root, generally not good idea
USER runner
# Force bash with environment
ENTRYPOINT [ "/bin/bash", "--login", "-c" ]