From affcfeb343b8dfe8262835a539f3f63d81446049 Mon Sep 17 00:00:00 2001 From: Muhammad Farhan Date: Sun, 27 Oct 2024 23:55:44 +0500 Subject: [PATCH] chore: Remove Dockerfile setup --- .dockerignore | 3 - .github/workflows/docker-publish.yml | 50 ------------- Dockerfile | 106 --------------------------- 3 files changed, 159 deletions(-) delete mode 100644 .dockerignore delete mode 100644 .github/workflows/docker-publish.yml delete mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 74828119fc..0000000000 --- a/.dockerignore +++ /dev/null @@ -1,3 +0,0 @@ -.dev/ -htmlcov/ -Dockerfile diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index 463c881d70..0000000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Build and Push Docker Images - -on: - push: - branches: - - master - - open-release/** -jobs: - push: - runs-on: ubuntu-22.04 - - steps: - - name: Checkout - uses: actions/checkout@v3 - - # Use the release name as the image tag if we're building an open release tag. - # Examples: if we're building 'open-release/olive.master', tag the image as 'olive.master'. - # Otherwise, we must be building from a push to master, so use 'latest'. - - name: Get tag name - id: get-tag-name - uses: actions/github-script@v6 - with: - script: | - const branchName = context.ref.split('/').slice(-1)[0]; - const tagName = branchName === 'master' ? 'latest' : branchName; - console.log('Will use tag: ' + tagName); - return tagName; - result-encoding: string - - - name: Build and push Dev Docker image - uses: docker/build-push-action@v1 - with: - push: true - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - target: dev - repository: edxops/discovery-dev - tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} - - # The current priority is to get the devstack off of Ansible based Images. Once that is done, we can come back to this part to get - # suitable images for smaller prod environments. - # - name: Build and push prod Docker image - # uses: docker/build-push-action@v1 - # with: - # push: true - # username: ${{ secrets.DOCKERHUB_USERNAME }} - # password: ${{ secrets.DOCKERHUB_PASSWORD }} - # target: prod - # repository: edxops/discovery-prod - # tags: ${{ steps.get-tag-name.outputs.result }},${{ github.sha }} diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 1def84d725..0000000000 --- a/Dockerfile +++ /dev/null @@ -1,106 +0,0 @@ -FROM ubuntu:focal as app - -ARG PYTHON_VERSION=3.12 - -ENV DEBIAN_FRONTEND noninteractive -ENV TZ=UTC - -# System requirements. -RUN apt-get update && \ - apt-get install -y software-properties-common && \ - apt-add-repository -y ppa:deadsnakes/ppa && \ - apt-get install -qy \ - curl \ - gettext \ - # required by bower installer - git \ - language-pack-en \ - build-essential \ - libmysqlclient-dev \ - libssl-dev \ - # TODO: Current version of Pillow (9.5.0) doesn't provide pre-built wheel for python 3.12, - # So this apt package is needed for building Pillow on 3.12, - # and can be removed when version of Pillow is upgraded to 10.5.0+ - libjpeg-dev \ - # mysqlclient >= 2.2.0 requires pkg-config. - pkg-config \ - libcairo2-dev \ - python3-pip \ - python${PYTHON_VERSION} \ - python${PYTHON_VERSION}-dev \ - python${PYTHON_VERSION}-distutils && \ - rm -rf /var/lib/apt/lists/* - -# 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 - -ARG COMMON_APP_DIR="/edx/app" -ARG COMMON_CFG_DIR="/edx/etc" -ARG DISCOVERY_SERVICE_NAME="discovery" -ARG DISCOVERY_APP_DIR="${COMMON_APP_DIR}/${DISCOVERY_SERVICE_NAME}" -ARG DISCOVERY_VENV_DIR="${COMMON_APP_DIR}/${DISCOVERY_SERVICE_NAME}/venvs/${DISCOVERY_SERVICE_NAME}" -ARG DISCOVERY_CODE_DIR="${DISCOVERY_APP_DIR}/${DISCOVERY_SERVICE_NAME}" -ARG DISCOVERY_NODEENV_DIR="${DISCOVERY_APP_DIR}/nodeenvs/${DISCOVERY_SERVICE_NAME}" - -ENV PATH "${DISCOVERY_VENV_DIR}/bin:${DISCOVERY_NODEENV_DIR}/bin:$PATH" -ENV DISCOVERY_CFG "/edx/etc/discovery.yml" -ENV DISCOVERY_CODE_DIR "${DISCOVERY_CODE_DIR}" -ENV DISCOVERY_APP_DIR "${DISCOVERY_APP_DIR}" -ENV PYTHON_VERSION "${PYTHON_VERSION}" - -# Setup zoneinfo for Python 3.12 -RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone - -RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION} -RUN pip install virtualenv - -RUN virtualenv -p python${PYTHON_VERSION} --always-copy ${DISCOVERY_VENV_DIR} - -# No need to activate discovery venv as it is already in path -RUN pip install nodeenv - -RUN nodeenv ${DISCOVERY_NODEENV_DIR} --node=16.14.0 --prebuilt && npm install -g npm@8.5.x - -# Working directory will be root of repo. -WORKDIR ${DISCOVERY_CODE_DIR} - -# Copy over repository -COPY . . - -RUN npm install --production && ./node_modules/.bin/bower install --allow-root --production && ./node_modules/.bin/webpack --config webpack.config.js --progress - -# Expose canonical Discovery port -EXPOSE 8381 - -FROM app as prod - -ENV DJANGO_SETTINGS_MODULE "course_discovery.settings.production" - -RUN pip install -r ${DISCOVERY_CODE_DIR}/requirements/production.txt - -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 - -ENV DJANGO_SETTINGS_MODULE "course_discovery.settings.devstack" - -RUN pip install -r ${DISCOVERY_CODE_DIR}/requirements/django.txt -RUN pip install -r ${DISCOVERY_CODE_DIR}/requirements/local.txt - -RUN DISCOVERY_CFG=minimal.yml OPENEDX_ATLAS_PULL=true make pull_translations - -# Devstack related step for backwards compatibility -RUN touch ${DISCOVERY_APP_DIR}/discovery_env - -CMD while true; do python ./manage.py runserver 0.0.0.0:8381; sleep 2; done - -########################################################### -# Define k8s target -FROM prod as kubernetes -ENV DISCOVERY_SETTINGS='kubernetes' -ENV DJANGO_SETTINGS_MODULE="course_discovery.settings.$DISCOVERY_SETTINGS"