From 3b9c09e10637693d7d8c343b540c3cbeb57a20b9 Mon Sep 17 00:00:00 2001 From: Bilal Qamar <59555732+BilalQamar95@users.noreply.github.com> Date: Wed, 30 Oct 2024 16:28:49 +0500 Subject: [PATCH 1/3] chore: removed dockerfile & workflow file --- .github/workflows/docker-publish.yml | 22 ---------- Dockerfile | 66 ---------------------------- docker-compose.yml | 3 +- 3 files changed, 1 insertion(+), 90 deletions(-) delete mode 100644 .github/workflows/docker-publish.yml delete mode 100644 Dockerfile diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index 0452cf22d..000000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Push Docker Images - -on: - push: - branches: - - main -jobs: - # Push image to GitHub Packages. - # See also https://docs.docker.com/docker-hub/builds/ - push: - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Build and Push docker image - env: - DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - run : make github_docker_push diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 082d74350..000000000 --- a/Dockerfile +++ /dev/null @@ -1,66 +0,0 @@ -FROM ubuntu:focal as app -MAINTAINER sre@edx.org - - -# Packages installed: - -# gcc; for compiling python extensions distributed with python packages like mysql-client -# git; for pulling requirements from GitHub. -# language-pack-en locales; ubuntu locale support so that system utilities have a consistent language and time zone. -# libmysqlclient-dev; to install header files needed to use native C implementation for MySQL-python for performance gains. -# libssl-dev; # mysqlclient wont install without this. -# pkg-config is now required for libmysqlclient-dev and its python dependencies -# python3-dev; to install header files for python extensions; much wheel-building depends on this -# python3-pip; install pip to install application requirements.txt files -# python; ubuntu doesnt ship with python, so this is the python we will use to run the application - -# If you add a package here please include a comment above describing what it is used for -RUN apt-get update && apt-get -qy install --no-install-recommends \ - gcc \ - git \ - language-pack-en \ - libmysqlclient-dev \ - libssl-dev \ - locales \ - pkg-config \ - python3-dev \ - python3-pip \ - python3.8 - - -RUN pip install --upgrade pip setuptools -# delete apt package lists because we do not need them inflating our image -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 DJANGO_SETTINGS_MODULE commerce_coordinator.settings.production - -EXPOSE 8140 -RUN useradd -m --shell /bin/false app - -WORKDIR /edx/app/commerce-coordinator - -# Copy the requirements explicitly even though we copy everything below -# this prevents the image cache from busting unless the dependencies have changed. -COPY requirements/production.txt /edx/app/commerce-coordinator/requirements/production.txt - -# Dependencies are installed as root so they cannot be modified by the application user. -RUN pip install -r requirements/production.txt - -RUN mkdir -p /edx/var/log - -# Code is owned by root so it cannot be modified by the application user. -# So we copy it before changing users. -USER app - -# Gunicorn 19 does not log to stdout or stderr by default. Once we are past gunicorn 19, the logging to STDOUT need not be specified. -CMD gunicorn --workers=2 --name commerce-coordinator -c /edx/app/commerce-coordinator/commerce_coordinator/docker_gunicorn_configuration.py --log-file - --max-requests=1000 commerce-coordinator.wsgi:application - -# This line is after the requirements so that changes to the code will not -# bust the image cache -COPY . /edx/app/commerce-coordinator diff --git a/docker-compose.yml b/docker-compose.yml index 636dfc26a..69f7ab62a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,8 +14,7 @@ services: container_name: commerce-coordinator.memcache app: - image: devstack # this should exist locally from previous devstack, we will build our Dockerfile - build: . # Build Dockerfile if we need to. + image: edxops/commerce-coordinator-dev container_name: commerce-coordinator.app volumes: - .:/edx/app/commerce-coordinator/ From 39ced81ebe68a6f7a58998dcace9dc52d2901342 Mon Sep 17 00:00:00 2001 From: Bilal Qamar <59555732+BilalQamar95@users.noreply.github.com> Date: Wed, 30 Oct 2024 17:54:43 +0500 Subject: [PATCH 2/3] chore: remove Dockerfile dependencies from Makefile and provision script --- Makefile | 23 ----------------------- provision-commerce-coordinator.sh | 5 +---- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 30c793003..849026e0e 100644 --- a/Makefile +++ b/Makefile @@ -155,17 +155,11 @@ start-devstack: ## run a local development copy of the server open-devstack: ## open a shell on the server started by start-devstack docker exec -it commerce-coordinator /edx/app/commerce-coordinator/devstack.sh open -pkg-devstack: ## build the commerce-coordinator image from the latest configuration and code - docker build -t commerce-coordinator:latest -f docker/build/commerce-coordinator/Dockerfile git://github.com/openedx/configuration - detect_changed_source_translations: ## check if translation files are up-to-date cd commerce_coordinator && i18n_tool changed validate_translations: fake_translations detect_changed_source_translations ## install fake translations and check if translation files are up-to-date -docker_build: - docker build . -f Dockerfile -t openedx/commerce-coordinator - dev.provision_docker: # start LMS, and Setup a clean commerce-coordinator stack. bash provision-commerce-coordinator.sh @@ -176,19 +170,12 @@ dev.run_test_query: dev.up: # Starts all containers docker-compose up -d -dev.up.build: - docker-compose up -d --build - dev.down: # Kills containers and all of their data that isn't in volumes docker-compose down dev.stop: # Stops containers so they can be restarted docker-compose stop -dev.multistack.up: - bash find-start-lms.sh - docker-compose up -d --build - dev.multistack.stop: docker compose -p devstack stop docker compose stop @@ -212,19 +199,9 @@ db-shell: # Run the app shell as root, enter the app's database %-attach: docker attach commerce_coordinator.$* -github_docker_build: - docker build . -f Dockerfile --target app -t openedx/commerce-coordinator - -github_docker_tag: github_docker_build - docker tag openedx/commerce-coordinator openedx/commerce-coordinator:${GITHUB_SHA} - github_docker_auth: echo "$$DOCKERHUB_PASSWORD" | docker login -u "$$DOCKERHUB_USERNAME" --password-stdin -github_docker_push: github_docker_tag github_docker_auth ## push to docker hub - docker push 'openedx/commerce-coordinator:latest' - docker push "openedx/commerce-coordinator:${GITHUB_SHA}" - selfcheck: ## check that the Makefile is well-formed @echo "The Makefile is well-formed." diff --git a/provision-commerce-coordinator.sh b/provision-commerce-coordinator.sh index dfdef86d8..d81b7ae64 100644 --- a/provision-commerce-coordinator.sh +++ b/provision-commerce-coordinator.sh @@ -12,10 +12,7 @@ NC="\x1B[0m" bash ./find-start-lms.sh docker-compose down -v # its ok if this fails. -docker-compose up -d --build - -# Install requirements -# Can be skipped right now because we're using the --build flag on docker-compose. This will need to be changed once we move to devstack. +docker-compose up -d # Wait for MySQL echo "Waiting for MySQL" From 804663d1fab2dd2997388e17c45a4293c6f3c875 Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Thu, 5 Dec 2024 22:24:17 +0500 Subject: [PATCH 3/3] build: update Makefile targets --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 849026e0e..5e9eb9974 100644 --- a/Makefile +++ b/Makefile @@ -176,6 +176,10 @@ dev.down: # Kills containers and all of their data that isn't in volumes dev.stop: # Stops containers so they can be restarted docker-compose stop +dev.multistack.up: + bash find-start-lms.sh + docker-compose up -d + dev.multistack.stop: docker compose -p devstack stop docker compose stop @@ -199,9 +203,6 @@ db-shell: # Run the app shell as root, enter the app's database %-attach: docker attach commerce_coordinator.$* -github_docker_auth: - echo "$$DOCKERHUB_PASSWORD" | docker login -u "$$DOCKERHUB_USERNAME" --password-stdin - selfcheck: ## check that the Makefile is well-formed @echo "The Makefile is well-formed."