Skip to content

Commit

Permalink
fix(deps): update dependency openai to v1.51.1 (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
pigri authored Oct 8, 2024
2 parents dce7b80 + d9c440e commit 655bcba
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 215 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cache-pull.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ jobs:
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/openshieldai/edge/cache
ghcr.io/openshieldai/openshield/cache
tags: |
type=sha
type=raw,value=latest
- name: Build
uses: docker/build-push-action@v6
with:
context: ./cache
context: services/cache
platforms: linux/arm64,linux/amd64
push: false
tags: ${{ steps.cache.outputs.tags }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/rule-server-pull.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- main
paths:
- services/rule-service/**
- services/rule/**
- .github/workflows/rule-server-pull.yaml

jobs:
Expand Down Expand Up @@ -34,11 +34,11 @@ jobs:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
cd rules/rule-service
cd services/rule
poetry install
- name: Run unit tests
run: |
cd rules/rule-service/rule_service/tests
cd services/rule/src/tests
poetry run python -m unittest test_api.py
rule-server-unit-test-arm:
if: github.event.review.state == 'approved'
Expand All @@ -64,11 +64,11 @@ jobs:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
cd service/rule
cd services/rule
poetry install
- name: Run unit tests
run: |
cd rules/rule-service/rule_service/tests
cd services/rule/src/tests
poetry run python -m unittest test_api.py
rule-service-docker-build:
Expand Down
6 changes: 3 additions & 3 deletions services/cache/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 20 additions & 56 deletions services/rule/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,39 @@ ENV PYTHONUNBUFFERED=1 \
POETRY_NO_INTERACTION=1 \
# never create virtual environment automaticly, only use env prepared by us
POETRY_VIRTUALENVS_CREATE=false \
\
# this is where our requirements + virtual environment will live
VIRTUAL_ENV="/venv" \
\
# Node.js major version. Remove if you don't need.
NODE_MAJOR=20
VIRTUAL_ENV="/venv"

# prepend poetry and venv to path
ENV PATH="$POETRY_HOME/bin:$VIRTUAL_ENV/bin:$PATH"

# prepare virtual env
RUN python -m venv $VIRTUAL_ENV
RUN python -m venv "$VIRTUAL_ENV"

# working directory and Python path
WORKDIR /app
ENV PYTHONPATH="/app"

# pretrained models cache path. Remove if you don't need.
# ref: https://huggingface.co/docs/transformers/installation?highlight=transformers_cache#caching-models
ENV TRANSFORMERS_CACHE="/opt/transformers_cache/"
ENV HF_HOME="/app/transformers_cache/"

################################
# BUILDER-BASE
# Used to build deps + create our virtual environment
################################
FROM python-base AS builder-base
RUN apt-get update && \
apt-get install -y \
apt-transport-https \
apt-get install --no-install-recommends -y apt-transport-https \
build-essential \
ca-certificates \
curl \
git \
gnupg \
nano
gnupg && \
apt-get clean

# install poetry - respects $POETRY_VERSION & $POETRY_HOME
# The --mount will mount the buildx cache directory to where
# Poetry and Pip store their cache so that they can re-use it
RUN --mount=type=cache,target=/root/.cache \
curl -sSL https://install.python-poetry.org | python -
RUN curl --proto "=https" --tlsv1.2 -sSf -L https://install.python-poetry.org | python -

# used to init dependencies
WORKDIR /app
Expand All @@ -71,55 +63,27 @@ COPY poetry.lock pyproject.toml ./
RUN poetry export -f requirements.txt > requirements.txt && \
python -m pip install -r requirements.txt

#COPY scripts scripts/
COPY rule_service/ rule_service/

# populate Huggingface model cache. Remove if you don't need.
#RUN poetry run python scripts/bootstrap.py

# build C dependencies. Remove if you don't need.
#RUN --mount=type=cache,target=/app/scripts/vendor \
# poetry run python scripts/build-c-denpendencies.py && \
# cp scripts/lib/*.so /usr/lib

#################################
## DEVELOPMENT
## Image used during development / testing
#################################
#FROM builder-base AS development
#
#WORKDIR /app
#
## quicker install AS runtime deps are already installed
#RUN --mount=type=cache,target=/root/.cache \
# poetry install --no-root --with test,lint
#
#EXPOSE 8080
#CMD ["bash"]


################################
# PRODUCTION
# Final image used for runtime
################################
#################################
FROM python-base AS production

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates && \
apt-get clean

# copy in our built poetry + venv
COPY --from=builder-base $POETRY_HOME $POETRY_HOME
COPY --from=builder-base $VIRTUAL_ENV $VIRTUAL_ENV
# copy in our C dependencies. Remove if you don't need.
#COPY --from=builder-base /app/scripts/lib/*.so /usr/lib
# copy in pre-populated transformer cache. Remove if you don't need.
#COPY --from=builder-base $TRANSFORMERS_CACHE $TRANSFORMERS_CACHE
apt-get clean && \
rm -rf /app && \
usermod -d /app -m nobody && \
mkdir -p /app && \
chown nobody:nogroup /app

WORKDIR /app
COPY poetry.lock pyproject.toml ./
COPY rule_service/ rule_service/
USER nobody:nogroup
# copy in our built poetry + venv
COPY --from=builder-base --chmod=755 --chown=nobody:nogroup $POETRY_HOME $POETRY_HOME
COPY --from=builder-base --chmod=755 --chown=nobody:nogroup $VIRTUAL_ENV $VIRTUAL_ENV

EXPOSE 8000
CMD ["python", "/app/rule_service/main.py"]
COPY --chmod=755 --chown=nobody:nogroup poetry.lock pyproject.toml src/main.py src/plugins ./
EXPOSE 8080
CMD ["python","src/main.py"]
Loading

0 comments on commit 655bcba

Please sign in to comment.