Skip to content

Commit

Permalink
feat: Build multipel test containers for codejail.
Browse files Browse the repository at this point in the history
Before we can test on the newer versions of python we need to build the
new images.  This PR updates the Dockerfile to Ubuntu 22.04 instead of
20.04 and uses deadksnakes to be able to install any relevant python
versions we might need.

We also update the publsh workflow to allow publishing multiple images.
  • Loading branch information
feanil committed Apr 23, 2024
1 parent 96abed1 commit 36e50ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/push-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ on:
jobs:
push:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- python_version: '3.8'
docker_tag: latest
- python_version: '3.11'
docker_tag: '3.11'

steps:
- name: Checkout
Expand All @@ -28,7 +35,6 @@ jobs:
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: openedx-codejail
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${{ matrix.docker_tag }} --build-arg ${{ matrix.python_version }} .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:${{ matrix.docker_tag }}
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
FROM ubuntu:focal
FROM ubuntu:22.04
SHELL ["/bin/bash", "-c"]

ARG python_version=3.8

# Install Codejail Packages
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y vim python3-virtualenv python3-pip
ENV TZ=Etc/UTC
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:deadsnakes/ppa && apt-get update && apt-get upgrade -y
RUN apt-get install -y vim python3-virtualenv python${python_version} python${python_version}-dev python${python_version}-distutils
RUN apt-get install -y sudo git

# Define Environment Variables
ENV CODEJAIL_GROUP=sandbox
ENV CODEJAIL_SANDBOX_CALLER=ubuntu
ENV CODEJAIL_TEST_USER=sandbox
ENV CODEJAIL_TEST_VENV=/home/sandbox/codejail_sandbox-python3.8
ENV CODEJAIL_TEST_VENV=/home/sandbox/codejail_sandbox-python

# Create Virtualenv for sandbox user
RUN virtualenv -p python3.8 --always-copy $CODEJAIL_TEST_VENV
RUN virtualenv -p /usr/bin/python${python_version} --always-copy $CODEJAIL_TEST_VENV

RUN virtualenv -p python3.8 venv
RUN virtualenv -p /usr/bin/python${python_version} venv
ENV VIRTUAL_ENV=/venv

# Add venv/bin to path
Expand Down

0 comments on commit 36e50ed

Please sign in to comment.