Create a set of base images for all other images to use (#13)

* Create a set of base images that other images use to reduce duplication
* Use docker driver to allow using locally built and cached images
* Add lsb-release, ca-certificates, and locales (or equivalent packages) to base images
* Add pip3 to ubuntu
This commit is contained in:
Will O'Beirne 2020-10-19 18:10:23 -05:00 committed by GitHub
parent 2b0636d439
commit 85fc274873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 239 additions and 216 deletions

View File

@ -19,6 +19,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver: docker
-
name: Cache Docker layers
uses: actions/cache@v2
@ -33,6 +35,51 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push - codercom/enterprise-base:arch
uses: docker/build-push-action@v2
with:
context: ./images/base
file: ./images/base/Dockerfile.arch
tags: codercom/enterprise-base:arch
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-base:centos
uses: docker/build-push-action@v2
with:
context: ./images/base
file: ./images/base/Dockerfile.centos
tags: codercom/enterprise-base:centos
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-base:ubuntu
uses: docker/build-push-action@v2
with:
context: ./images/base
file: ./images/base/Dockerfile.ubuntu
tags: codercom/enterprise-base:ubuntu
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-multieditor:centos
uses: docker/build-push-action@v2
with:
context: ./images/multieditor
file: ./images/multieditor/Dockerfile.centos
tags: codercom/enterprise-multieditor:centos
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-multieditor:ubuntu
uses: docker/build-push-action@v2
with:
context: ./images/multieditor
file: ./images/multieditor/Dockerfile.ubuntu
tags: codercom/enterprise-multieditor:ubuntu
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-configure:ubuntu
uses: docker/build-push-action@v2
@ -41,6 +88,7 @@ jobs:
file: ./images/configure/Dockerfile.ubuntu
tags: codercom/enterprise-configure:ubuntu
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-goland:centos
uses: docker/build-push-action@v2
@ -49,6 +97,7 @@ jobs:
file: ./images/goland/Dockerfile.centos
tags: codercom/enterprise-goland:centos
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-goland:ubuntu
uses: docker/build-push-action@v2
@ -57,6 +106,7 @@ jobs:
file: ./images/goland/Dockerfile.ubuntu
tags: codercom/enterprise-goland:ubuntu
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-intellij:centos
uses: docker/build-push-action@v2
@ -65,6 +115,7 @@ jobs:
file: ./images/intellij/Dockerfile.centos
tags: codercom/enterprise-intellij:centos
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-intellij:ubuntu
uses: docker/build-push-action@v2
@ -73,6 +124,7 @@ jobs:
file: ./images/intellij/Dockerfile.ubuntu
tags: codercom/enterprise-intellij:ubuntu
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-jupyter:centos
uses: docker/build-push-action@v2
@ -81,6 +133,7 @@ jobs:
file: ./images/jupyter/Dockerfile.centos
tags: codercom/enterprise-jupyter:centos
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-jupyter:ubuntu
uses: docker/build-push-action@v2
@ -89,6 +142,7 @@ jobs:
file: ./images/jupyter/Dockerfile.ubuntu
tags: codercom/enterprise-jupyter:ubuntu
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-pycharm:centos
uses: docker/build-push-action@v2
@ -97,6 +151,7 @@ jobs:
file: ./images/pycharm/Dockerfile.centos
tags: codercom/enterprise-pycharm:centos
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-pycharm:ubuntu
uses: docker/build-push-action@v2
@ -105,6 +160,7 @@ jobs:
file: ./images/pycharm/Dockerfile.ubuntu
tags: codercom/enterprise-pycharm:ubuntu
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-webstorm:centos
uses: docker/build-push-action@v2
@ -113,6 +169,7 @@ jobs:
file: ./images/webstorm/Dockerfile.centos
tags: codercom/enterprise-webstorm:centos
push: ${{ github.event_name != 'pull_request' }}
load: true
-
name: Build and push - codercom/enterprise-webstorm:ubuntu
uses: docker/build-push-action@v2
@ -121,3 +178,4 @@ jobs:
file: ./images/webstorm/Dockerfile.ubuntu
tags: codercom/enterprise-webstorm:ubuntu
push: ${{ github.event_name != 'pull_request' }}
load: true

View File

@ -9,6 +9,21 @@ with different IDEs.
See our [documentation at our Enterprise Hub](https://enterprise.coder.com/docs/multi-editor) for additional information
about supported editors and known issues.
## Image Minimums
All of the images provided in this repo include the following utilities to ensure they work well
with all of Coder Enterprise's features, and to provide a solid out-of-the-box developer experience:
* git
* bash
* curl & wget
* htop
* man
* vim
* sudo
* python3 & pip3
* gcc & gcc-c++ & make
## Images on Docker Hub
Each of these images is also published to Docker Hub under the `codercom/enterprise-[name]`

View File

@ -18,6 +18,8 @@ jobs:
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver: docker
-
name: Cache Docker layers
uses: actions/cache@v2

View File

@ -4,6 +4,9 @@ set -euo pipefail
CI_TEMPLATE="bin/ci-template.yaml"
CI_FILE=".github/workflows/ci.yaml"
# Some images need to build before others, everything else can go in any order
ORDERED_IMAGES=("base" "multieditor")
function copyTemplate() {
rm -rf $CI_FILE
echo -e "# File generated by bin/generate-actions-yaml.sh\n$(cat $CI_TEMPLATE)" > $CI_FILE
@ -21,6 +24,7 @@ function appendAction() {
echo " file: ./images/$image/Dockerfile.$tag"
echo " tags: codercom/enterprise-$image:$tag"
echo " push: \${{ github.event_name != 'pull_request' }}"
echo " load: true"
} >> $CI_FILE
}
@ -31,9 +35,19 @@ function main() {
# Create template yaml
copyTemplate
# Add an action per Dockerfile
image_dirs=$(ls images)
for image in ${image_dirs[@]}; do
# Add actions for building each image, maintaining desired image order
image_dirs=($(ls images))
all_images=("${ORDERED_IMAGES[@]}" "${image_dirs[@]}")
seen_images=()
for image in ${all_images[@]}; do
# Skip image if we've already seen it, duplicates come from ORDERED_IMAGES
if [[ "${seen_images[@]}" =~ "${image}" ]]; then
continue
fi
seen_images+=("$image")
# Create action per dockerfile
dockerfiles=$(ls images/$image/Dockerfile*)
for dockerfile in ${dockerfiles}; do
tag=${dockerfile##*.}

View File

@ -0,0 +1,25 @@
FROM archlinux/base
SHELL ["/bin/bash", "-c"]
# Install baseline packages
RUN pacman --noconfirm -Syu \
base \
base-devel \
git \
bash \
curl \
wget \
htop \
man \
vim \
sudo \
python3 \
openssh \
lsb-release \
ca-certificates
# Add coder user.
RUN useradd -mUs /bin/bash coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
USER coder

View File

@ -0,0 +1,27 @@
FROM centos:8
# Add the EPEL repolist
RUN yum -y install epel-release
RUN yum repolist
# Install baseline packages
RUN yum update -y && yum install -y \
gcc \
gcc-c++ \
make \
git \
bash \
curl \
wget \
htop \
man \
vim \
sudo \
python3 \
redhat-lsb-core \
ca-certificates
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
USER coder

View File

@ -0,0 +1,23 @@
FROM ubuntu:20.04
# Install baseline packages
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y \
build-essential \
git \
bash \
curl \
wget \
htop \
man \
vim \
sudo \
python3 \
python3-pip \
lsb-release \
ca-certificates \
locales
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser --gecos '' --disabled-password coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
USER coder

View File

@ -1,23 +1,7 @@
FROM centos:8
FROM codercom/enterprise-multieditor:centos
RUN yum update -y && yum install -y \
which \
git \
bash \
curl \
man \
vim \
sudo \
gnupg \
# The following libraries are required for the IDE to be able to communicate with
# code-server through xserver messaging.
openssl \
libXtst \
libXrender \
fontconfig \
libXi \
gtk3 \
libGL
# Run everything as root
USER root
# Install goland.
RUN mkdir -p /opt/goland
@ -26,7 +10,5 @@ RUN curl -L "https://download.jetbrains.com/product?code=GO&latest&distribution=
# Add a binary to the PATH that points to the goland startup script.
RUN ln -s /opt/goland/bin/goland.sh /usr/bin/goland
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
# Set back to coder user
USER coder

View File

@ -1,24 +1,7 @@
FROM ubuntu:20.04
FROM codercom/enterprise-multieditor:ubuntu
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y \
git \
bash \
curl \
htop \
man \
vim \
ssh \
sudo \
lsb-release \
ca-certificates \
locales \
gnupg \
# Packages required for multi-editor support
libxtst6 \
libxrender1 \
libfontconfig1 \
libxi6 \
libgtk-3-0
# Run everything as root
USER root
# Install goland.
RUN mkdir -p /opt/goland
@ -27,7 +10,5 @@ RUN curl -L "https://download.jetbrains.com/product?code=GO&latest&distribution=
# Add a binary to the PATH that points to the goland startup script.
RUN ln -s /opt/goland/bin/goland.sh /usr/bin/goland
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser --gecos '' --disabled-password coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
# Set back to coder user
USER coder

View File

@ -1,23 +1,7 @@
FROM centos:8
FROM codercom/enterprise-multieditor:centos
RUN yum update -y && yum install -y \
which \
git \
bash \
curl \
man \
vim \
sudo \
gnupg \
# The following libraries are required for the IDE to be able to communicate with
# code-server through xserver messaging.
openssl \
libXtst \
libXrender \
fontconfig \
libXi \
gtk3 \
libGL
# Run everything as root
USER root
# Install intellij.
RUN mkdir -p /opt/idea
@ -26,7 +10,5 @@ RUN curl -L "https://download.jetbrains.com/product?code=IIC&latest&distribution
# Add a binary to the PATH that points to the intellij startup script.
RUN ln -s /opt/idea/bin/idea.sh /usr/bin/intellij-idea-ultimate
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
# Set back to coder user
USER coder

View File

@ -1,24 +1,7 @@
FROM ubuntu:20.04
FROM codercom/enterprise-multieditor:ubuntu
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y \
git \
bash \
curl \
htop \
man \
vim \
ssh \
sudo \
lsb-release \
ca-certificates \
locales \
gnupg \
# Packages required for multi-editor support
libxtst6 \
libxrender1 \
libfontconfig1 \
libxi6 \
libgtk-3-0
# Run everything as root
USER root
# Install intellij.
RUN mkdir -p /opt/idea
@ -27,7 +10,5 @@ RUN curl -L "https://download.jetbrains.com/product?code=IIC&latest&distribution
# Add a binary to the PATH that points to the intellij startup script.
RUN ln -s /opt/idea/bin/idea.sh /usr/bin/intellij-idea-community
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser --gecos '' --disabled-password coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
# Set back to coder user
USER coder

View File

@ -1,20 +1,10 @@
FROM centos:8
FROM codercom/enterprise-base:centos
RUN yum update -y && yum install -y \
which \
git \
bash \
curl \
man \
vim \
sudo \
gnupg \
python36
# Run everything as root
USER root
# Install jupyter
RUN pip3 install jupyterlab
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
# Set back to coder user
USER coder

View File

@ -1,25 +1,10 @@
FROM ubuntu:20.04
FROM codercom/enterprise-base:ubuntu
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y \
git \
bash \
curl \
htop \
man \
vim \
ssh \
sudo \
lsb-release \
ca-certificates \
locales \
gnupg \
python3 \
python3-pip
# Run everything as root
USER root
# Install jupyter
RUN pip3 install jupyterlab
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser --gecos '' --disabled-password coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
# Set back to coder user
USER coder

View File

@ -0,0 +1,17 @@
FROM codercom/enterprise-base:centos
# Run everything as root
USER root
# Packages required for multi-editor support
RUN yum update -y && yum install -y \
openssl \
libXtst \
libXrender \
fontconfig \
libXi \
gtk3 \
libGL
# Set back to coder user
USER coder

View File

@ -0,0 +1,15 @@
FROM codercom/enterprise-base:ubuntu
# Run everything as root
USER root
# Packages required for multi-editor support
RUN DEBIAN_FRONTEND="noninteractive" apt-get install -y \
libxtst6 \
libxrender1 \
libfontconfig1 \
libxi6 \
libgtk-3-0
# Set back to coder user
USER coder

View File

@ -1,23 +1,7 @@
FROM centos:8
FROM codercom/enterprise-multieditor:centos
RUN yum update -y && yum install -y \
which \
git \
bash \
curl \
man \
vim \
sudo \
gnupg \
# The following libraries are required for the IDE to be able to communicate with
# code-server through xserver messaging.
openssl \
libXtst \
libXrender \
fontconfig \
libXi \
gtk3 \
libGL
# Run everything as root
USER root
# Install pycharm.
RUN mkdir -p /opt/pycharm
@ -26,7 +10,5 @@ RUN curl -L "https://download.jetbrains.com/product?code=PCC&latest&distribution
# Add a binary to the PATH that points to the pycharm startup script.
RUN ln -s /opt/pycharm/bin/pycharm.sh /usr/bin/pycharm
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
# Set back to coder user
USER coder

View File

@ -1,24 +1,7 @@
FROM ubuntu:20.04
FROM codercom/enterprise-multieditor:ubuntu
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y \
git \
bash \
curl \
htop \
man \
vim \
ssh \
sudo \
lsb-release \
ca-certificates \
locales \
gnupg \
# Packages required for multi-editor support
libxtst6 \
libxrender1 \
libfontconfig1 \
libxi6 \
libgtk-3-0
# Run everything as root
USER root
# Install pycharm.
RUN mkdir -p /opt/pycharm
@ -27,7 +10,5 @@ RUN curl -L "https://download.jetbrains.com/product?code=PCC&latest&distribution
# Add a binary to the PATH that points to the pycharm startup script.
RUN ln -s /opt/pycharm/bin/pycharm.sh /usr/bin/pycharm
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser --gecos '' --disabled-password coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
# Set back to coder user
USER coder

View File

@ -1,23 +1,7 @@
FROM centos:8
FROM codercom/enterprise-multieditor:centos
RUN yum update -y && yum install -y \
which \
git \
bash \
curl \
man \
vim \
sudo \
gnupg \
# The following libraries are required for the IDE to be able to communicate with
# code-server through xserver messaging.
openssl \
libXtst \
libXrender \
fontconfig \
libXi \
gtk3 \
libGL
# Run everything as root
USER root
# Install webstorm.
RUN mkdir -p /opt/webstorm
@ -26,7 +10,5 @@ RUN curl -L "https://download.jetbrains.com/product?code=WS&latest&distribution=
# Add a binary to the PATH that points to the webstorm startup script.
RUN ln -s /opt/webstorm/bin/webstorm.sh /usr/bin/webstorm
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
# Set back to coder user
USER coder

View File

@ -1,24 +1,7 @@
FROM ubuntu:20.04
FROM codercom/enterprise-multieditor:ubuntu
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y \
git \
bash \
curl \
htop \
man \
vim \
ssh \
sudo \
lsb-release \
ca-certificates \
locales \
gnupg \
# Packages required for multi-editor support
libxtst6 \
libxrender1 \
libfontconfig1 \
libxi6 \
libgtk-3-0
# Run everything as root
USER root
# Install webstorm.
RUN mkdir -p /opt/webstorm
@ -27,7 +10,5 @@ RUN curl -L "https://download.jetbrains.com/product?code=WS&latest&distribution=
# Add a binary to the PATH that points to the webstorm startup script.
RUN ln -s /opt/webstorm/bin/webstorm.sh /usr/bin/webstorm
# Add a user `coder` so that you're not developing as the `root` user
RUN adduser --gecos '' --disabled-password coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
# Set back to coder user
USER coder