Skip to content

Commit

Permalink
Use new base images (#39)
Browse files Browse the repository at this point in the history
* Convert Dockerfile to use new standard base images

* improve Dockerfile comments

* version set the base images
  • Loading branch information
dustinblack authored Jul 5, 2023
1 parent 57bd651 commit 0fdd7b5
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,46 +1,41 @@
# Package path for this plugin module relative to the repo root
ARG package=arcaflow_plugin_template_python

# build poetry
FROM quay.io/centos/centos:stream8 as poetry
# STAGE 1 -- Build module dependencies and run tests
# The 'poetry' and 'coverage' modules are installed and verson-controlled in the
# quay.io/arcalot/arcaflow-plugin-baseimage-python-buildbase image to limit drift
FROM quay.io/arcalot/arcaflow-plugin-baseimage-python-buildbase:0.1.0 as build
ARG package
RUN dnf -y module install python39 && dnf -y install python39 python39-pip

WORKDIR /app

COPY poetry.lock /app/
COPY pyproject.toml /app/

RUN python3.9 -m pip install poetry==1.4.2 \
&& python3.9 -m poetry config virtualenvs.create false \
&& python3.9 -m poetry install --without dev --no-root \
# Convert the dependencies from poetry to a static requirements.txt file
RUN python3.9 -m poetry install --without dev --no-root \
&& python3.9 -m poetry export -f requirements.txt --output requirements.txt --without-hashes

# run tests
COPY ${package}/ /app/${package}
COPY tests /app/${package}/tests

ENV PYTHONPATH /app/${package}
WORKDIR /app/${package}

RUN mkdir /htmlcov
RUN python3.9 -m pip install coverage==7.2.7 \
&& python3.9 -m coverage run tests/test_${package}.py \
# Run tests and return coverage analysis
RUN python3.9 -m coverage run tests/test_${package}.py \
&& python3.9 -m coverage html -d /htmlcov --omit=/usr/local/*


# final image
FROM quay.io/centos/centos:stream8
# STAGE 2 -- Build final plugin image
FROM quay.io/arcalot/arcaflow-plugin-baseimage-python-osbase:0.1.0
ARG package
RUN dnf -y module install python39 && dnf -y install python39 python39-pip

WORKDIR /app

COPY --from=poetry /app/requirements.txt /app/
COPY --from=poetry /htmlcov /htmlcov/
COPY --from=build /app/requirements.txt /app/
COPY --from=build /htmlcov /htmlcov/
COPY LICENSE /app/
COPY README.md /app/
COPY ${package}/ /app/${package}

# Install all plugin dependencies from the generated requirements.txt file
RUN python3.9 -m pip install -r requirements.txt

WORKDIR /app/${package}
Expand Down

0 comments on commit 0fdd7b5

Please sign in to comment.