6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-11-14 09:14:14 +00:00

Merge remote-tracking branch 'origin/master' into nightly

This commit is contained in:
Overhang.IO 2023-03-20 14:13:55 +00:00
commit 465d8075b5
9 changed files with 23 additions and 17 deletions

View File

@ -0,0 +1 @@
- [Improvement] Faster build with `npm clean-install` instead of `npm install` in the openedx Docker image. This may change the version of npm packages installed next to edx-platform. (by @regisb)

View File

@ -0,0 +1 @@
- [Feature] Introduce the `DOCKER_BUILD_COMMAND` which makes it possible to customize the `docker build` command. (by @regisb)

View File

@ -0,0 +1 @@
- [Improvement] During openedx image build, copy `dockerize` utility from Docker registry for better efficiency. (by @regisb)

View File

@ -0,0 +1 @@
- [Improvement] Better highlight enabled plugins in `tutor plugins list`. (by @regisb)

View File

@ -1,6 +1,6 @@
from datetime import datetime
from time import sleep
from typing import Any, List, Optional, Type, Iterable
from typing import Any, Iterable, List, Optional, Type
import click

View File

@ -335,7 +335,7 @@ def plugin_status(name: str) -> str:
Return the status of a plugin. Either: "enabled", "installed" or "not installed".
"""
if plugins.is_loaded(name):
return "enabled"
return "enabled"
if plugins.is_installed(name):
return "installed"
return "not installed"

View File

@ -282,13 +282,20 @@ class Filters:
"config:overrides"
)
#: Declare uniqaue configuration settings that must be saved in the user ``config.yml`` file. This is where
#: Declare unique configuration settings that must be saved in the user ``config.yml`` file. This is where
#: you should declare passwords and randomly-generated values that are different from one environment to the next.
#:
#: :parameter list[tuple[str, ...]] items: list of (name, value) new settings. All
#: names must be prefixed with the plugin name in all-caps.
CONFIG_UNIQUE: Filter[list[tuple[str, Any]], []] = filters.get("config:unique")
#: Use this filter to modify the ``docker build`` command. For instance, to replace
#: the ``build`` subcommand by ``buildx build``.
#:
#: :parameter list[str] command: the full build command, including options and
#: arguments. Note that these arguments do not include the leading ``docker`` command.
DOCKER_BUILD_COMMAND: Filter[list[str], []] = filters.get("docker:build:command")
#: List of patches that should be inserted in a given location of the templates. The
#: filter name must be formatted with the patch name.
#: This filter is not so convenient and plugin developers will probably

View File

@ -1,5 +1,5 @@
from . import fmt, utils
from .types import Config, get_typed
from tutor import fmt, hooks, utils
from tutor.types import Config, get_typed
def get_tag(config: Config, name: str) -> str:
@ -9,7 +9,10 @@ def get_tag(config: Config, name: str) -> str:
def build(path: str, tag: str, *args: str) -> None:
fmt.echo_info(f"Building image {tag}")
utils.docker("build", "-t", tag, *args, path)
command = hooks.Filters.DOCKER_BUILD_COMMAND.apply(
["build", "-t", tag, *args, path]
)
utils.docker(*command)
def pull(tag: str) -> None:

View File

@ -21,15 +21,6 @@ RUN git clone https://github.com/pyenv/pyenv $PYENV_ROOT --branch v2.2.2 --depth
RUN $PYENV_ROOT/bin/pyenv install $PYTHON_VERSION
RUN $PYENV_ROOT/versions/$PYTHON_VERSION/bin/python -m venv /openedx/venv
###### Install Dockerize to wait for mysql DB availability
FROM minimal as dockerize
# https://github.com/powerman/dockerize/releases
ARG DOCKERIZE_VERSION=v0.16.0
RUN dockerize_url="https://github.com/powerman/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-$(uname -m | sed 's@aarch@arm@')" \
&& echo "Downloading dockerize from $dockerize_url" \
&& curl --fail --location --output /usr/local/bin/dockerize $dockerize_url \
&& chmod a+x /usr/local/bin/dockerize
###### Checkout edx-platform code
FROM minimal as code
ARG EDX_PLATFORM_REPOSITORY={{ EDX_PLATFORM_REPOSITORY }}
@ -112,7 +103,7 @@ ARG NPM_REGISTRY={{ NPM_REGISTRY }}
COPY --from=code /openedx/edx-platform/package.json /openedx/edx-platform/package.json
COPY --from=code /openedx/edx-platform/package-lock.json /openedx/edx-platform/package-lock.json
WORKDIR /openedx/edx-platform
RUN npm install --verbose --registry=$NPM_REGISTRY
RUN npm clean-install --verbose --registry=$NPM_REGISTRY
###### Production image with system and python requirements
FROM minimal as production
@ -129,7 +120,8 @@ RUN if [ "$APP_USER_ID" = 0 ]; then echo "app user may not be root" && false; fi
RUN useradd --home-dir /openedx --create-home --shell /bin/bash --uid ${APP_USER_ID} app
USER ${APP_USER_ID}
COPY --from=dockerize /usr/local/bin/dockerize /usr/local/bin/dockerize
# https://hub.docker.com/r/powerman/dockerize/tags
COPY --from=docker.io/powerman/dockerize:0.19.0 /usr/local/bin/dockerize /usr/local/bin/dockerize
COPY --chown=app:app --from=code /openedx/edx-platform /openedx/edx-platform
COPY --chown=app:app --from=locales /openedx/locale /openedx/locale
COPY --chown=app:app --from=python /opt/pyenv /opt/pyenv