Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfile and compose config for testing #699

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions contrib/images/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ARG PYTHON_IMG_TAG
FROM python:${PYTHON_IMG_TAG}-slim-bookworm as base


FROM base as build
RUN set -ex \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install \
-y --no-install-recommends \
"build-essential" \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /code
COPY ../../ ./
# Install with dev dependencies for tests
RUN pip install .[dev] \
--user --no-warn-script-location --no-cache-dir


FROM base as runtime
ENV PATH="/root/.local/bin:$PATH"
RUN set -ex \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install \
-y --no-install-recommends \
"openjdk-17-jdk" \
&& rm -rf /var/lib/apt/lists/*
# Copy Python deps from build to runtime
COPY --from=build \
/root/.local \
/root/.local
WORKDIR /code
ENTRYPOINT ["xlsform"]
19 changes: 19 additions & 0 deletions contrib/images/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

version: "3"

name: pyxform

services:
pyxform:
image: "ghcr.io/xlsform/pyxform:ci"
build:
context: ../../
dockerfile: contrib/images/Dockerfile
target: runtime
args:
PYTHON_IMG_TAG: "${PYTHON_IMG_TAG:-3.10}"
volumes:
- ../../tests:/code/tests
- ../../pyxform:/root/.local/lib/python3.10/site-packages/pyxform
entrypoint: ["python", "-m", "unittest", "--verbose"]
restart: "unless-stopped"