From 7ddaa513b15ef5ebc188b3d7ff6f7691d853db7a Mon Sep 17 00:00:00 2001 From: Nicolas Giard Date: Wed, 16 Mar 2022 21:23:01 -0400 Subject: [PATCH] ci: build base test docker image --- .github/workflows/build-test-base.yml | 36 ++++++++ dev/docker-test-base/Dockerfile | 120 ++++++++++++++++++++++++++ 2 files changed, 156 insertions(+) create mode 100644 .github/workflows/build-test-base.yml create mode 100644 dev/docker-test-base/Dockerfile diff --git a/.github/workflows/build-test-base.yml b/.github/workflows/build-test-base.yml new file mode 100644 index 000000000..e8c24c03d --- /dev/null +++ b/.github/workflows/build-test-base.yml @@ -0,0 +1,36 @@ +name: Build Base Test Docker Image + +on: + push: + branches: + # TEMPORARY: Replace with main once bs5 is merged + - 'feat/bs5' + paths: + - 'package.json' + - 'requirements.txt' + + workflow_dispatch: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: datatracker-test-base + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v2 + + - name: Docker Build & Push Action + uses: mr-smithers-excellent/docker-build-push@v5.6 + with: + image: ${{ env.IMAGE_NAME }} + tags: latest + registry: ${{ env.REGISTRY }} + dockerfile: dev/docker-test-base/Dockerfile + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} diff --git a/dev/docker-test-base/Dockerfile b/dev/docker-test-base/Dockerfile new file mode 100644 index 000000000..ca3e164a7 --- /dev/null +++ b/dev/docker-test-base/Dockerfile @@ -0,0 +1,120 @@ +FROM python:3.6-bullseye +LABEL maintainer="IETF Tools Team " + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update +RUN apt-get -qy upgrade + +# Add Node.js Source +RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - + +# Install the packages we need +RUN apt-get install -qy \ + apache2-utils \ + apt-file \ + apt-utils \ + bash \ + build-essential \ + curl \ + enscript \ + gawk \ + gcc \ + ghostscript \ + git \ + gnupg \ + graphviz \ + jq \ + less \ + libcairo2-dev \ + libgtk2.0-0 \ + libgtk-3-0 \ + libnotify-dev \ + libgconf-2-4 \ + libgbm-dev \ + libnss3 \ + libxss1 \ + libasound2 \ + libxtst6 \ + libmagic-dev \ + libmariadb-dev \ + libtidy-dev \ + locales \ + mariadb-client \ + netcat \ + nodejs \ + pigz \ + pv \ + python3-ipython \ + ripgrep \ + rsync \ + rsyslog \ + ruby \ + ruby-rubygems \ + unzip \ + wget \ + xauth \ + xvfb \ + yang-tools + +# Install kramdown-rfc2629 (ruby) +RUN gem install kramdown-rfc2629 + +# Install chromedriver +COPY docker/scripts/app-install-chromedriver.sh /tmp/app-install-chromedriver.sh +RUN sed -i 's/\r$//' /tmp/app-install-chromedriver.sh && \ + chmod +x /tmp/app-install-chromedriver.sh +RUN /tmp/app-install-chromedriver.sh + +# Get rid of installation files we don't need in the image, to reduce size +RUN apt-get clean && rm -rf /var/lib/apt/lists/* + +# "fake" dbus address to prevent errors +# https://github.com/SeleniumHQ/docker-selenium/issues/87 +ENV DBUS_SESSION_BUS_ADDRESS=/dev/null + +# avoid million NPM install messages +ENV npm_config_loglevel warn +# allow installing when the main user is root +ENV npm_config_unsafe_perm true +# disable NPM funding messages +ENV npm_config_fund false + +# Set locale to en_US.UTF-8 +RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \ + echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \ + echo "LANG=en_US.UTF-8" > /etc/locale.conf && \ + dpkg-reconfigure locales && \ + locale-gen en_US.UTF-8 && \ + update-locale LC_ALL en_US.UTF-8 +ENV LC_ALL en_US.UTF-8 + +# Install idnits +ADD https://raw.githubusercontent.com/ietf-tools/idnits-mirror/main/idnits /usr/local/bin/ +RUN chmod +rx /usr/local/bin/idnits + +# Install current datatracker python dependencies +COPY requirements.txt /tmp/pip-tmp/ +RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ + && rm -rf /tmp/pip-tmp + +# Turn off rsyslog kernel logging (doesn't work in Docker) +RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf + +# Fetch wait-for utility +ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/ +RUN chmod +rx /usr/local/bin/wait-for + +# Copy the startup file +COPY docker/scripts/app-init.sh /docker-init.sh +RUN sed -i 's/\r$//' /docker-init.sh && \ + chmod +x /docker-init.sh + +# Create workspace +RUN mkdir -p /workspace +WORKDIR /workspace + +# Install NPM modules +COPY package.json package.json +RUN npm install --no-audit +RUN rm -f package.json package-lock.json \ No newline at end of file