ci: build app base docker image

This commit is contained in:
Nicolas Giard 2022-05-24 15:50:01 -04:00 committed by GitHub
parent bf22223877
commit a7d080b4df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 140 additions and 5 deletions

View file

@ -1,4 +1,4 @@
name: Build Base Test Docker Image
name: Build Base App Docker Image
on:
push:
@ -7,13 +7,13 @@ on:
paths:
- 'package.json'
- 'requirements.txt'
- 'dev/tests/Dockerfile'
- 'docker/base.Dockerfile'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: datatracker-test-base
IMAGE_NAME: datatracker-app-base
jobs:
publish:
@ -25,12 +25,12 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Docker Build & Push Action
- name: Docker Build & Push
uses: mr-smithers-excellent/docker-build-push@v5.6
with:
image: ${{ env.IMAGE_NAME }}
tags: latest
registry: ${{ env.REGISTRY }}
dockerfile: dev/tests/Dockerfile
dockerfile: docker/base.Dockerfile
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

135
docker/base.Dockerfile Normal file
View file

@ -0,0 +1,135 @@
FROM python:3.9-bullseye
LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>"
ENV DEBIAN_FRONTEND=noninteractive
# Update system packages
RUN apt-get update
RUN apt-get -qy upgrade
# Add Node.js Source
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
# Add Docker Source
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install the packages we need
RUN apt-get update --fix-missing && apt-get install -qy \
apache2-utils \
apt-file \
apt-utils \
bash \
build-essential \
curl \
default-jdk \
docker-ce-cli \
enscript \
gawk \
g++ \
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 \
libmemcached-tools \
locales \
make \
mariadb-client \
memcached \
nano \
netcat \
nodejs \
pigz \
pv \
python3-ipython \
ripgrep \
rsync \
rsyslog \
ruby \
ruby-rubygems \
unzip \
wget \
xauth \
xvfb \
yang-tools \
zsh
# 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
# Fix /dev/shm permissions for chromedriver
RUN chmod 1777 /dev/shm
# Activate Yarn
RUN corepack enable
# Get rid of installation files we don't need in the image, to reduce size
RUN apt-get autoremove -y && apt-get clean -y && 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
# Turn off rsyslog kernel logging (doesn't work in Docker)
RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
# Colorize the bash shell
RUN sed -i 's/#force_color_prompt=/force_color_prompt=/' /root/.bashrc
# 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
# Create workspace
RUN mkdir -p /workspace
WORKDIR /workspace