Skip to content

Commit

Permalink
Merge branch 'main' into huniafatima/consolidate-image-publish-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
huniafatima-arbi committed Nov 28, 2024
2 parents 6b5afa6 + 3d7cdb9 commit 796aeb7
Show file tree
Hide file tree
Showing 21 changed files with 341 additions and 119 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push-edx-analytics-dashboard-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
file: ./dockerfiles/edx-analytics-dashboard.Dockerfile
push: true
target: dev
tags: edxops/edx-analytics-dashboard-dev:${{ steps.get-tag-name.outputs.result }}
tags: edxops/insights-dev:${{ steps.get-tag-name.outputs.result }}

- name: Send failure notification
if: failure()
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push-enterprise-access-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
push: true
target: devstack
tags: edxops/enterprise-access-dev:${{ steps.get-tag-name.outputs.result }}
platforms: linux/amd64,linux/arm64

- name: Send failure notification
if: failure()
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push-enterprise-catalog-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
push: true
target: legacy_devapp
tags: edxops/enterprise-catalog-dev:${{ steps.get-tag-name.outputs.result }}
platforms: linux/amd64,linux/arm64

- name: Send failure notification
if: failure()
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/push-enterprise-subsidy-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
push: true
target: devstack
tags: edxops/enterprise-subsidy-dev:${{ steps.get-tag-name.outputs.result }}
platforms: linux/amd64,linux/arm64

- name: Send failure notification
if: failure()
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/push-license-manager-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build and Push License Manager Image

on:
workflow_dispatch:
inputs:
branch:
description: "Target branch from which the source dockerfile from image will be sourced"

schedule:
- cron: "0 4 * * 1-5" # UTC Time

jobs:
build-and-push-image:
runs-on: ubuntu-latest

steps:
- name: Get tag name
id: get-tag-name
uses: actions/github-script@v5
with:
script: |
const tagName = "${{ github.event.inputs.branch }}" || 'latest';
console.log('Will use tag: ' + tagName);
return tagName;
result-encoding: string

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push Dev Docker image
uses: docker/build-push-action@v6
with:
file: ./dockerfiles/license-manager.Dockerfile
push: true
target: app
tags: edxops/license-manager-dev:${{ steps.get-tag-name.outputs.result }}
platforms: linux/amd64,linux/arm64

# Commenting the notification section temporarily as we don't have the owning team email for titans yet.
# - name: Send failure notification
# if: failure()
# uses: dawidd6/action-send-mail@v3
# with:
# server_address: email-smtp.us-east-1.amazonaws.com
# server_port: 465
# username: ${{secrets.edx_smtp_username}}
# password: ${{secrets.edx_smtp_password}}
# subject: Push Image to docker.io/edxops failed in License Manager Coordinator
# to: [email protected]
# from: github-actions <[email protected]>
# body: Push Image to docker.io/edxops for License Manager Coordinator failed! For details see "github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
10 changes: 5 additions & 5 deletions dockerfiles/commerce-coordinator.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:focal as app
FROM ubuntu:focal AS app
MAINTAINER [email protected]


Expand Down Expand Up @@ -37,11 +37,11 @@ RUN rm -rf /var/lib/apt/lists/*
RUN ln -s /usr/bin/python3 /usr/bin/python

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
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

ENV DJANGO_SETTINGS_MODULE commerce_coordinator.settings.production
ENV DJANGO_SETTINGS_MODULE=commerce_coordinator.settings.production

EXPOSE 8140

Expand Down
11 changes: 7 additions & 4 deletions dockerfiles/course-discovery.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:focal as app
FROM ubuntu:focal AS app

ARG PYTHON_VERSION=3.12

Expand Down Expand Up @@ -75,7 +75,7 @@ RUN npm install --production && ./node_modules/.bin/bower install --allow-root -
# Expose canonical Discovery port
EXPOSE 8381

FROM app as prod
FROM app AS prod

ENV DJANGO_SETTINGS_MODULE "course_discovery.settings.production"

Expand All @@ -85,7 +85,9 @@ RUN DISCOVERY_CFG=minimal.yml OPENEDX_ATLAS_PULL=true make pull_translations

CMD gunicorn --bind=0.0.0.0:8381 --workers 2 --max-requests=1000 -c course_discovery/docker_gunicorn_configuration.py course_discovery.wsgi:application

FROM app as dev
FROM app AS dev

RUN curl -L -o ${DISCOVERY_CODE_DIR}/course_discovery/settings/devstack.py https://raw.githubusercontent.com/edx/devstack/master/py_configuration_files/course-discovery.py

ENV DJANGO_SETTINGS_MODULE "course_discovery.settings.devstack"

Expand All @@ -101,6 +103,7 @@ CMD while true; do python ./manage.py runserver 0.0.0.0:8381; sleep 2; done

###########################################################
# Define k8s target
FROM prod as kubernetes

FROM prod AS kubernetes
ENV DISCOVERY_SETTINGS='kubernetes'
ENV DJANGO_SETTINGS_MODULE="course_discovery.settings.$DISCOVERY_SETTINGS"
19 changes: 11 additions & 8 deletions dockerfiles/credentials.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:focal as base
FROM ubuntu:focal AS base

# System requirements
# - git; Used to pull in particular requirements from github rather than pypi,
Expand Down Expand Up @@ -35,12 +35,12 @@ ENV PATH="$NODE_ENV/bin:$PATH"
RUN npm install -g [email protected]

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
ENV DJANGO_SETTINGS_MODULE credentials.settings.production
ENV OPENEDX_ATLAS_PULL true
ENV CREDENTIALS_CFG "minimal.yml"
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
ENV DJANGO_SETTINGS_MODULE=credentials.settings.production
ENV OPENEDX_ATLAS_PULL=true
ENV CREDENTIALS_CFG="minimal.yml"

EXPOSE 18150
RUN useradd -m --shell /bin/false app
Expand Down Expand Up @@ -94,8 +94,11 @@ CMD gunicorn --workers=2 --name credentials -c /edx/app/credentials/credentials/

# We don't switch back to the app user for devstack because we need devstack users to be
# able to update requirements and generally run things as root.
FROM base as dev
FROM base AS dev
USER root

RUN curl -L -o credentials/settings/devstack.py https://raw.githubusercontent.com/edx/devstack/master/py_configuration_files/credentials.py

ENV DJANGO_SETTINGS_MODULE credentials.settings.devstack
RUN pip install -r /edx/app/credentials/credentials/requirements/dev.txt
RUN make pull_translations
Expand Down
8 changes: 5 additions & 3 deletions dockerfiles/ecommerce.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:focal as app
FROM ubuntu:focal AS app

ENV DEBIAN_FRONTEND noninteractive
# System requirements.
Expand Down Expand Up @@ -55,7 +55,7 @@ RUN npm install --production && ./node_modules/.bin/bower install --allow-root -
# Expose canonical ecommerce port
EXPOSE 18130

FROM app as prod
FROM app AS prod

ENV DJANGO_SETTINGS_MODULE "ecommerce.settings.production"

Expand All @@ -71,7 +71,7 @@ RUN curl -L https://github.com/edx/ecommerce/archive/refs/heads/2u/main.tar.gz |

CMD gunicorn --bind=0.0.0.0:18130 --workers 2 --max-requests=1000 -c ecommerce/docker_gunicorn_configuration.py ecommerce.wsgi:application

FROM app as dev
FROM app AS dev

ENV DJANGO_SETTINGS_MODULE "ecommerce.settings.devstack"

Expand All @@ -88,4 +88,6 @@ RUN touch ${ECOMMERCE_APP_DIR}/ecommerce_env
# every time any bit of code is changed.
RUN curl -L https://github.com/openedx/ecommerce/archive/refs/heads/2u/main.tar.gz | tar -xz --strip-components=1

RUN curl -L -o ${ECOMMERCE_CODE_DIR}/ecommerce/settings/devstack.py https://raw.githubusercontent.com/edx/devstack/master/py_configuration_files/ecommerce.py

CMD while true; do python ./manage.py runserver 0.0.0.0:18130; sleep 2; done
30 changes: 16 additions & 14 deletions dockerfiles/edx-analytics-dashboard.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:focal as app
FROM ubuntu:focal AS app

ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive

ARG PYTHON_VERSION=3.8

Expand Down Expand Up @@ -30,23 +30,23 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*

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
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

# ENV variables lifetime is bound to the container whereas ARGS variables lifetime is bound to the image building process only
# Also ARGS provide us an option of compatibility of Path structure for Tutor and other OpenedX installations
ARG COMMON_CFG_DIR "/edx/etc"
ARG COMMON_CFG_DIR="/edx/etc"
ARG COMMON_APP_DIR="/edx/app"
ARG INSIGHTS_APP_DIR="${COMMON_APP_DIR}/insights"
ARG INSIGHTS_VENV_DIR="${COMMON_APP_DIR}/insights/venvs/insights"
ARG INSIGHTS_CODE_DIR="${INSIGHTS_APP_DIR}/edx_analytics_dashboard"
ARG INSIGHTS_NODEENV_DIR="${COMMON_APP_DIR}/insights/nodeenvs/insights"

ENV PATH "${INSIGHTS_VENV_DIR}/bin:${INSIGHTS_NODEENV_DIR}/bin:$PATH"
ENV INSIGHTS_APP_DIR ${INSIGHTS_APP_DIR}
ENV THEME_SCSS "sass/themes/open-edx.scss"
ENV PYTHON_VERSION "${PYTHON_VERSION}"
ENV PATH="${INSIGHTS_VENV_DIR}/bin:${INSIGHTS_NODEENV_DIR}/bin:$PATH"
ENV INSIGHTS_APP_DIR=${INSIGHTS_APP_DIR}
ENV THEME_SCSS="sass/themes/open-edx.scss"
ENV PYTHON_VERSION="${PYTHON_VERSION}"

RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION}
RUN pip install virtualenv
Expand All @@ -67,6 +67,8 @@ RUN pip install --no-cache-dir -r requirements/production.txt

RUN curl -L https://github.com/edx/edx-analytics-dashboard/archive/refs/heads/master.tar.gz | tar -xz --strip-components=1

RUN curl -L -o ${INSIGHTS_CODE_DIR}/analytics_dashboard/settings/devstack.py https://raw.githubusercontent.com/edx/devstack/master/py_configuration_files/course-discovery.py

RUN nodeenv ${INSIGHTS_NODEENV_DIR} --node=18.20.2 --prebuilt \
&& npm install -g [email protected]

Expand All @@ -75,20 +77,20 @@ RUN npm set progress=false && npm ci
EXPOSE 8110
EXPOSE 18110

FROM app as dev
FROM app AS dev

RUN pip install --no-cache-dir -r requirements/local.txt

ENV DJANGO_SETTINGS_MODULE "analytics_dashboard.settings.devstack"
ENV DJANGO_SETTINGS_MODULE="analytics_dashboard.settings.devstack"

# Backwards compatibility with devstack
RUN touch "${INSIGHTS_APP_DIR}/insights_env"

CMD while true; do python ./manage.py runserver 0.0.0.0:8110; sleep 2; done

FROM app as prod
FROM app AS prod

ENV DJANGO_SETTINGS_MODULE "analytics_dashboard.settings.production"
ENV DJANGO_SETTINGS_MODULE="analytics_dashboard.settings.production"

CMD gunicorn \
--pythonpath=/edx/app/insights/edx_analytics_dashboard/analytics_dashboard \
Expand Down
30 changes: 16 additions & 14 deletions dockerfiles/edx-analytics-data-api.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:focal as base
FROM ubuntu:focal AS base

# System requirements.

Expand All @@ -17,7 +17,7 @@ RUN apt-get update && \

RUN apt-get update && \
apt-get install -qy \
build-essential \
build-essential \
curl \
vim \
language-pack-en \
Expand All @@ -39,21 +39,21 @@ RUN pip install virtualenv

# Use UTF-8.
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
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

ARG COMMON_APP_DIR="/edx/app"
ARG ANALYTICS_API_SERVICE_NAME="analytics_api"
ENV ANALYTICS_API_HOME "${COMMON_APP_DIR}/${ANALYTICS_API_SERVICE_NAME}"
ENV ANALYTICS_API_HOME="${COMMON_APP_DIR}/${ANALYTICS_API_SERVICE_NAME}"
ARG ANALYTICS_API_APP_DIR="${COMMON_APP_DIR}/${ANALYTICS_API_SERVICE_NAME}"
ARG ANALYTICS_API_VENV_DIR="${COMMON_APP_DIR}/${ANALYTICS_API_SERVICE_NAME}/venvs/${ANALYTICS_API_SERVICE_NAME}"
ARG ANALYTICS_API_CODE_DIR="${ANALYTICS_API_APP_DIR}/${ANALYTICS_API_SERVICE_NAME}"

ENV ANALYTICS_API_CODE_DIR="${ANALYTICS_API_CODE_DIR}"
ENV PATH "${ANALYTICS_API_VENV_DIR}/bin:$PATH"
ENV COMMON_CFG_DIR "/edx/etc"
ENV ANALYTICS_API_CFG "/edx/etc/${ANALYTICS_API_SERVICE_NAME}.yml"
ENV PATH="${ANALYTICS_API_VENV_DIR}/bin:$PATH"
ENV COMMON_CFG_DIR="/edx/etc"
ENV ANALYTICS_API_CFG="/edx/etc/${ANALYTICS_API_SERVICE_NAME}.yml"

# Working directory will be root of repo.
WORKDIR ${ANALYTICS_API_CODE_DIR}
Expand All @@ -66,9 +66,9 @@ RUN mkdir -p requirements
# Expose canonical Analytics port
EXPOSE 19001

FROM base as prod
FROM base AS prod

ENV DJANGO_SETTINGS_MODULE "analyticsdataserver.settings.production"
ENV DJANGO_SETTINGS_MODULE="analyticsdataserver.settings.production"


RUN curl -L -o requirements/production.txt https://raw.githubusercontent.com/edx/edx-analytics-data-api/master/requirements/production.txt
Expand All @@ -85,9 +85,7 @@ RUN curl -L https://github.com/edx/edx-analytics-data-api/archive/refs/heads/mas

CMD ["gunicorn" , "-b", "0.0.0.0:8100", "--pythonpath", "/edx/app/analytics_api/analytics_api","analyticsdataserver.wsgi:application"]

FROM base as dev

ENV DJANGO_SETTINGS_MODULE "analyticsdataserver.settings.devstack"
FROM base AS dev

RUN curl -L -o requirements/dev.txt https://raw.githubusercontent.com/edx/edx-analytics-data-api/master/requirements/dev.txt

Expand All @@ -98,6 +96,10 @@ RUN pip install -r ${ANALYTICS_API_CODE_DIR}/requirements/dev.txt
# every time any bit of code is changed.
RUN curl -L https://github.com/edx/edx-analytics-data-api/archive/refs/heads/master.tar.gz | tar -xz --strip-components=1

RUN curl -L -o ${ANALYTICS_API_CODE_DIR}/analyticsdataserver/settings/devstack.py https://raw.githubusercontent.com/edx/devstack/master/py_configuration_files/analytics_data_api.py

ENV DJANGO_SETTINGS_MODULE "analyticsdataserver.settings.devstack"

# Devstack related step for backwards compatibility
RUN touch /edx/app/${ANALYTICS_API_SERVICE_NAME}/${ANALYTICS_API_SERVICE_NAME}_env

Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/edx-exams.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:focal as app
FROM ubuntu:focal AS app
LABEL org.opencontainers.image.authors="[email protected]"


Expand Down
Loading

0 comments on commit 796aeb7

Please sign in to comment.