-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into nightly
- Loading branch information
Showing
7 changed files
with
68 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- [Feature] Improve support of auto-mounted ecommerce repository. (by @regisb) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,19 +3,48 @@ | |
FROM docker.io/ubuntu:20.04 as minimal | ||
|
||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked{% endif %} \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked{% endif %} \ | ||
apt update && \ | ||
apt install -y curl git-core language-pack-en libmysqlclient-dev libssl-dev python3 python3-pip python3-venv | ||
apt install -y curl git-core language-pack-en | ||
|
||
###### Checkout code | ||
FROM minimal as checkout | ||
|
||
ARG ECOMMERCE_REPOSITORY=https://github.com/edx/ecommerce.git | ||
ARG ECOMMERCE_VERSION='{{ OPENEDX_COMMON_VERSION }}' | ||
RUN mkdir -p /openedx/ecommerce && \ | ||
git clone $ECOMMERCE_REPOSITORY --branch $ECOMMERCE_VERSION --depth 1 /openedx/ecommerce | ||
|
||
# Identify tutor user to cherry-pick commits | ||
RUN git config --global user.email "[email protected]" \ | ||
&& git config --global user.name "Tutor" | ||
|
||
##### Empty layer with just the repo at the root. | ||
# This is useful when overriding the build context with a host repo: | ||
# docker build --build-context /path/to/ecommerce | ||
FROM scratch as ecommerce-src | ||
COPY --from=checkout /openedx/ecommerce / | ||
|
||
###### Install python and virtual environment | ||
FROM minimal as python | ||
|
||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/var/cache/apt,sharing=locked \ | ||
--mount=type=cache,target=/var/lib/apt,sharing=locked{% endif %} \ | ||
apt update && \ | ||
apt install -y libmysqlclient-dev libssl-dev python3 python3-pip python3-venv | ||
|
||
ARG APP_USER_ID=1000 | ||
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} | ||
|
||
# Create cache dir. Otherwise, for some reason, it becomes owned by root. | ||
RUN mkdir /openedx/.cache | ||
|
||
# Create python venv | ||
RUN python3 -m venv /openedx/venv/ | ||
ENV PATH "/openedx/venv/bin:$PATH" | ||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install \ | ||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared,uid=${APP_USER_ID} {% endif %}pip install \ | ||
# https://pypi.org/project/setuptools/ | ||
# https://pypi.org/project/pip/ | ||
# https://pypi.org/project/wheel/ | ||
|
@@ -27,34 +56,27 @@ RUN pip install nodeenv==1.7.0 | |
RUN nodeenv /openedx/nodeenv --node=16.20.0 --prebuilt | ||
ENV PATH /openedx/nodeenv/bin:${PATH} | ||
|
||
# Install ecommerce | ||
ARG ECOMMERCE_REPOSITORY=https://github.com/edx/ecommerce.git | ||
ARG ECOMMERCE_VERSION='{{ OPENEDX_COMMON_VERSION }}' | ||
RUN mkdir -p /openedx/ecommerce && \ | ||
git clone $ECOMMERCE_REPOSITORY --branch $ECOMMERCE_VERSION --depth 1 /openedx/ecommerce | ||
# Copy ecommerce source code | ||
COPY --from=ecommerce-src --chown=app:app / /openedx/ecommerce | ||
WORKDIR /openedx/ecommerce | ||
|
||
# Identify tutor user to cherry-pick commits | ||
RUN git config --global user.email "[email protected]" \ | ||
&& git config --global user.name "Tutor" | ||
|
||
# Install npm, bower requirements | ||
ARG NPM_REGISTRY='{{ NPM_REGISTRY }}' | ||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.npm/,sharing=shared,uid=${APP_USER_ID} {% endif %}npm clean-install --verbose --no-audit --registry=$NPM_REGISTRY | ||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/bower,sharing=shared,uid=${APP_USER_ID} {% endif %}./node_modules/.bin/bower install --allow-root | ||
|
||
# python requirements | ||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install -r requirements.txt | ||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared,uid=${APP_USER_ID} {% endif %}pip install -r requirements.txt | ||
# https://pypi.org/project/uWSGI/ | ||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install uwsgi==2.0.21 | ||
RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared,uid=${APP_USER_ID} {% endif %}pip install uwsgi==2.0.21 | ||
|
||
# Install private requirements: this is useful for installing custom payment processors. | ||
COPY --chown=app:app ./requirements/ /openedx/requirements | ||
RUN cd /openedx/requirements/ \ | ||
&& touch ./private.txt \ | ||
&& pip install -r ./private.txt | ||
|
||
{% for extra_requirement in ECOMMERCE_EXTRA_PIP_REQUIREMENTS %}RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared {% endif %}pip install '{{ extra_requirement }}' | ||
{% for extra_requirement in ECOMMERCE_EXTRA_PIP_REQUIREMENTS %}RUN {% if is_buildkit_enabled() %}--mount=type=cache,target=/openedx/.cache/pip,sharing=shared,uid=${APP_USER_ID} {% endif %}pip install '{{ extra_requirement }}' | ||
{% endfor %} | ||
|
||
# Collect static assets (aka: "make static") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters