From 39f23bd9ea31424aa75917e56498bf6989a01e00 Mon Sep 17 00:00:00 2001 From: Tim McCormack Date: Thu, 16 Jan 2025 21:03:52 +0000 Subject: [PATCH] feat: Add codejail service This is just a skeleton image and doesn't have any directories or packages that are specific to codejail yet. Lots of differences from cookiecutter django-ida default: - Remove MySQL system packages - Use latest Ubuntu LTS - Shorten the base folder from `codejail-service` to `codejail` - Use port 8080; we'll remap it in compose anyhow - Use ADD on a git repo rather than RUN/curl/tar, which runs afoul of Docker caching when a branch is used. - Allow selecting a commit version - Pass `DJANGO_SETTINGS_MODULE` from outside as env var to reduce differences between dev and prod targets and add flexibility. - Install in /app and create virtualenv in /venv; no need to hew to the same pattern we used in the configuration repo. - Remove apt cache in same RUN command so as not to create a fat layer - Use heredoc syntax for multi-command RUN - No log files, just log to stdout See https://github.com/edx/edx-arch-experiments/issues/894 --- .github/workflows/push-docker-images.yml | 1 + dockerfiles/codejail.Dockerfile | 91 ++++++++++++++++++++++++ images-data.json | 6 ++ 3 files changed, 98 insertions(+) create mode 100644 dockerfiles/codejail.Dockerfile diff --git a/.github/workflows/push-docker-images.yml b/.github/workflows/push-docker-images.yml index c055a30..a332148 100644 --- a/.github/workflows/push-docker-images.yml +++ b/.github/workflows/push-docker-images.yml @@ -26,6 +26,7 @@ on: - xqueue - portal designer - license manager + - codejail branch: description: "Target branch from which the source dockerfile from image will be sourced" default: "main" diff --git a/dockerfiles/codejail.Dockerfile b/dockerfiles/codejail.Dockerfile new file mode 100644 index 0000000..51dd3b4 --- /dev/null +++ b/dockerfiles/codejail.Dockerfile @@ -0,0 +1,91 @@ +# Usage: +# +# - Listens on port 8080 internally +# - Set environment variable `DJANGO_SETTINGS_MODULE`, e.g. to +# `codejail_service.settings.production` or `codejail_service.settings.devstack` +# - Override arg `VERSION` to a commit hash or a branch + +FROM ubuntu:noble AS app + +ARG GITHUB_REPO=openedx/codejail-service + +# This should be overridden with a commit hash to ensure we always get +# a coherent result, even if things are changing on a branch as the +# image is being built. +# +# Must use the full 40-character hash when specifying a commit hash. +ARG VERSION=main + +# Python version +ARG PYVER=3.12 + +# Packages installed: +# +# - language-pack-en, locales: Ubuntu locale support so that system utilities +# have a consistent language and time zone. +# - python*: A specific version of Python +# - python*-dev: Header files for python extensions, required by many source wheels +# - python*-venv: Allow creation of virtualenvs +RUN <