diff --git a/.github/workflows/docker-matrix.yml b/.github/workflows/docker-matrix.yml index 9fde6e6..b1421dc 100644 --- a/.github/workflows/docker-matrix.yml +++ b/.github/workflows/docker-matrix.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: image-tag: ['3.12-slim-bullseye'] - update-strategy: [default, update, unlocked-install, unpegged-install] + update-strategy: [default, update, unlocked-install, latest-install] steps: - name: Checkout code @@ -42,11 +42,11 @@ jobs: elif [[ "${{ matrix.update-strategy }}" == "unlocked-install" ]]; then echo "Running normal test with updated dependencies" - docker build --no-cache --build-arg IMAGE_TAG=${{ matrix.image-tag }} --target test-unlocked-install -t zephir-api2:test . + docker build --no-cache --build-arg IMAGE_TAG=${{ matrix.image-tag }} --target build-unlocked-test -t zephir-api2:test . - elif [[ "${{ matrix.update-strategy }}" == "unpegged-install" ]]; then + elif [[ "${{ matrix.update-strategy }}" == "latest-install" ]]; then echo "Running normal test with updated dependencies" - docker build --no-cache --build-arg IMAGE_TAG=${{ matrix.image-tag }} --target test-unpegged-install -t zephir-api2:test . + docker build --no-cache --build-arg IMAGE_TAG=${{ matrix.image-tag }} --target build-latest-test -t zephir-api2:test . fi \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 45d5774..8570ef6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,38 +61,25 @@ USER app RUN poetry run pytest tests RUN poetry show -FROM build AS test-unlocked-install -# Uninstall poetry and install it again -RUN pip uninstall -y poetry -# Remove poetry.lock and install dependencies -RUN rm poetry.lock -RUN pip install poetry -RUN poetry install --no-root --without dev && rm -rf ${POETRY_CACHE_DIR}; -RUN poetry install --only dev --no-root && rm -rf ${POETRY_CACHE_DIR}; +FROM poetry AS build-unlocked-test +COPY pyproject.toml ./ +RUN poetry install --no-root && rm -rf ${POETRY_CACHE_DIR}; COPY . . # Run tests USER app RUN poetry run pytest tests -FROM build AS test-unpegged-install -# Uninstall poetry and install it again -RUN pip uninstall -y poetry -# Remove poetry.lock and install dependencies -RUN rm poetry.lock -## Substitute all numbers in pyproject.toml with * +FROM poetry AS build-latest-test +COPY pyproject.toml ./ RUN sed -i 's/\^/>=/g' pyproject.toml -# Print toml file -RUN cat pyproject.toml -RUN pip install poetry -RUN poetry install --no-root --without dev && rm -rf ${POETRY_CACHE_DIR}; -RUN poetry install --only dev --no-root && rm -rf ${POETRY_CACHE_DIR}; +RUN poetry install --no-root && rm -rf ${POETRY_CACHE_DIR}; COPY . . # Run tests USER app RUN poetry run pytest tests +RUN cat pyproject.toml RUN poetry show - FROM base AS production RUN mkdir -p /venv && chown ${UID}:${GID} /venv