Skip to content

Commit

Permalink
merge fix for docker building
Browse files Browse the repository at this point in the history
  • Loading branch information
luclaurent committed Nov 29, 2024
2 parents dc3ebc0 + e143a88 commit 7709156
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 19 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,25 @@ jobs:
name: 'Build amc2moodle container'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- id: docker-tag
uses: yuya-takeyama/docker-tag-from-github-ref-action@v1
with:
latest-branches: 'main,master'
- name: "Build:checkout"
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Login to Github Packages
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.PAT }}
- name: 'Build:dockerimage'
uses: docker/build-push-action@v2
id: docker_build
uses: docker/build-push-action@v6
with:
# relative path to the place where source code with Dockerfile is located
context: ./docker
Expand Down
2 changes: 1 addition & 1 deletion amc2moodle/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.10.4'
__version__ = '2.11.0'
34 changes: 21 additions & 13 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,47 @@ FROM texlive/texlive:latest
# labels
LABEL AUTHOR='Luc Laurent'
LABEL MAINTAINER='Luc Laurent & Benoit Nennig'
LABEL org.opencontainers.image.source = "https://github.com/nennigb/amc2moodle/"
LABEL org.opencontainers.image.source="https://github.com/nennigb/amc2moodle/"

# declare useful directories using environement
ENV MONITOR_DIR=/tmp/work
ENV LOG_DIR=/tmp/daemon
ENV INSTALL_DIR_A2M=/tmp/amc2moodle
ENV VENVDIR=/tmp/venv
SHELL ["/bin/bash", "-c"]

# install debian packages
RUN apt update && \
apt install -yy wget ghostscript imagemagick libtext-unidecode-perl latexml xmlindent python3-pip git && \
apt clean
apt install -yy wget \
ghostscript \
imagemagick \
libtext-unidecode-perl \
latexml \
xmlindent \
python3-pip \
python3-venv \
git && \
apt clean &&\
rm -rf /var/lib/{apt,dpkg,cache,log}/

# move policy file
RUN mv /etc/ImageMagick-6/policy.xml /etc/ImageMagick-6/policy.xml.off

# install pip and Python pkg
# RUN pip3 install -U pip && \
# pip install amc2moodle
WORKDIR /tmp
RUN git clone https://github.com/nennigb/amc2moodle.git -b master ${INSTALL_DIR_A2M}
WORKDIR ${INSTALL_DIR_A2M}
RUN pip3 install -U pip && \
pip3 install .
RUN mkdir -p ${VENVDIR} && \
python -m venv ${VENVDIR}
ENV PATH="${VENVDIR}/bin:$PATH"
RUN pip install -U pip && \
pip install '.[test]'

# check if amc2moodle and moodle2amc work
WORKDIR /
ENV TEXINPUTS=.:${INSTALL_DIR_A2M}/amc2moodle/moodle2amc/test:$TEXINPUTS
ENV TEXINPUTS=.:${INSTALL_DIR_A2M}/amc2moodle/tests/payload_test_moodle2amc/:${TEXINPUTS}
RUN echo ${TEXINPUTS}
RUN python -m amc2moodle.amc2moodle.test && \
python -m amc2moodle.utils.test && \
python -m amc2moodle.moodle2amc.test


RUN python -m pytest --pyargs amc2moodle

# create dir
RUN mkdir ${MONITOR_DIR} && \
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ dependencies = [
]
requires-python='>=3.8'

[project.optional-dependencies]
test = ["pytest", "pytest-cov[all]"]
lint = [ "black", "flake8"]

[project.urls]
Homepage = "https://github.com/nennigb/amc2moodle"
Repository = "https://github.com/nennigb/amc2moodle"
Expand Down

0 comments on commit 7709156

Please sign in to comment.