Skip to content

Commit

Permalink
chore: back merge main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
huniafatima-arbi committed Jan 29, 2025
1 parent e1a8776 commit 4acc5b3
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 28 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/push-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -96,7 +97,9 @@ jobs:
push: true
platforms: ${{ matrix.images.os_platform }}
target: ${{ matrix.images.target }}
tags: edxops/${{matrix.images.image_name}}-dev:${{ steps.get-publish-date.outputs.result }}
tags: |
edxops/${{matrix.images.image_name}}-dev:${{ steps.get-publish-date.outputs.result }}
edxops/${{matrix.images.image_name}}-dev:latest
- name: Send failure notification
if: ${{ failure() && (matrix.images.owning_team_email) }}
Expand Down
27 changes: 0 additions & 27 deletions README.md

This file was deleted.

91 changes: 91 additions & 0 deletions dockerfiles/codejail.Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <<EOF
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install \
--quiet --yes --no-install-recommends \
language-pack-en locales \
python${PYVER} python${PYVER}-dev python${PYVER}-venv
# If you add a package, please add a comment above explaining why it is needed!
rm -rf /var/lib/apt/lists/*
EOF

RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

WORKDIR /app

# We'll build the virtualenv and pre-compile Python as root, but switch to user
# `app` for actually running the application.
RUN useradd -m --shell /bin/false app

# Unpack the repo directly from GitHub, since this image is not built
# from inside the application repo.
#
# Start with getting just the requirements files so that code changes
# do not bust the image cache and require rebuilding the virtualenv.
ADD https://github.com/${GITHUB_REPO}.git#${VERSION}:requirements requirements

RUN <<EOF
python${PYVER} -m venv /venv
/venv/bin/pip install -r /app/requirements/pip.txt
/venv/bin/pip install -r /app/requirements/pip-tools.txt
EOF

EXPOSE 8080


FROM app AS dev

RUN /venv/bin/pip-sync requirements/dev.txt
RUN python${PYVER} -m compileall /venv

# Add code changes after deps installation so it won't bust the image cache
ADD https://github.com/${GITHUB_REPO}.git#${VERSION} .
RUN python${PYVER} -m compileall /app

USER app
CMD echo $PATH; while true; do /venv/bin/python ./manage.py runserver 0.0.0.0:8080; sleep 2; done


FROM app AS prod

RUN /venv/bin/pip-sync requirements/base.txt
RUN python${PYVER} -m compileall /venv

# Add code changes after deps installation so it won't bust the image cache
ADD https://github.com/${GITHUB_REPO}.git#${VERSION} .
RUN python${PYVER} -m compileall /app

USER app
CMD /venv/bin/gunicorn -c /app/codejail_service/docker_gunicorn_configuration.py \
--bind '0.0.0.0:8080' --workers=2 --max-requests=1000 --name codejail \
codejail_service.wsgi:application
6 changes: 6 additions & 0 deletions images-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,11 @@
"os_platform": "linux/amd64,linux/arm64",
"target": "dev",
"owning_team_email": "[email protected]"
},
{
"image_name": "codejail",
"name": "codejail",
"os_platform": "linux/amd64,linux/arm64",
"target": "dev"
}
]

0 comments on commit 4acc5b3

Please sign in to comment.