Skip to content

Commit

Permalink
Merge pull request #25 from a-luna:fix-gh-action-deploy_attempt-11
Browse files Browse the repository at this point in the history
Update Unicode API deployment configuration
  • Loading branch information
a-luna authored Jan 8, 2024
2 parents c0aa9cc + 031efe2 commit 564f2f2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_unicode_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
push: true
set: |
unicode-api.args.REDIS_PW=${{ secrets.REDIS_PW }}
unicode-api.args.TEST1=BAKE_SET1
unicode-api.args.UNICODE_VERSION=${{ secrets.UNICODE_VERSION }}
- name: Deploy unicode-api docker image to dokku
uses: dokku/github-action@master
with:
Expand Down
9 changes: 0 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ ARG RATE_LIMIT_PER_PERIOD
ARG RATE_LIMIT_PERIOD_SECONDS
ARG RATE_LIMIT_BURST
ARG TEST_HEADER
ARG TEST1
ARG TEST2

ENV ENV=${ENV}
ENV UNICODE_VERSION=${UNICODE_VERSION}
Expand All @@ -23,19 +21,12 @@ ENV RATE_LIMIT_PER_PERIOD=${RATE_LIMIT_PER_PERIOD}
ENV RATE_LIMIT_PERIOD_SECONDS=${RATE_LIMIT_PERIOD_SECONDS}
ENV RATE_LIMIT_BURST=${RATE_LIMIT_BURST}
ENV TEST_HEADER=${TEST_HEADER}
ENV TEST1=${TEST1}
ENV TEST2=${TEST2}

WORKDIR /code
RUN pip install -U pip setuptools wheel
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
EXPOSE 80
COPY ./app /code/app

RUN echo REDIS_PW: $REDIS_PW
RUN echo TEST1: $TEST1
RUN echo TEST2: $TEST2

RUN PYTHONPATH=/code/. python /code/./app/data/scripts/get_prod_data.py
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
2 changes: 1 addition & 1 deletion app/data/scripts/get_prod_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
def get_prod_data() -> Result[None]:
result = bootstrap_unicode_data()
if result.failure or not result.value:
return Result.Fail(result.error if result.error else "")
return Result.Fail(result.error or "")
settings = result.value

logger = logging.getLogger("app.api")
Expand Down
18 changes: 6 additions & 12 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,23 @@ variable "REDIS_PW" {
default = ""
}

variable "TEST1" {
default = "NOT_SECRET1"
}

variable "TEST2" {
default = "NOT_SECRET2"
variable "UNICODE_VERSION" {
default = ""
}

target "unicode-api" {
dockerfile = "./Dockerfile"
tags = ["ghcr.io/a-luna/unicode-api:${GITHUB_SHA}"]
args = {
ENV="PROD"
UNICODE_VERSION="14.0.0"
UNICODE_VERSION="${UNICODE_VERSION}"
REDIS_HOST="dokku-redis-vig-cache"
REDIS_PORT="6379"
REDIS_DB="1"
REDIS_PW="${REDIS_PW}"
RATE_LIMIT_PER_PERIOD="45"
RATE_LIMIT_PERIOD_SECONDS="55"
RATE_LIMIT_BURST="5"
RATE_LIMIT_PER_PERIOD="50"
RATE_LIMIT_PERIOD_SECONDS="60"
RATE_LIMIT_BURST="10"
TEST_HEADER="X-UnicodeAPI-Test"
TEST1="${TEST1}"
TEST2="${TEST2}"
}
}

0 comments on commit 564f2f2

Please sign in to comment.