Skip to content

Commit

Permalink
Merge pull request #23 from a-luna:fix-gh-action-deploy_attempt-9
Browse files Browse the repository at this point in the history
Update Docker actions and environment variables
  • Loading branch information
a-luna authored Jan 6, 2024
2 parents 9289d5d + ab0c767 commit cc47a4c
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 35 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/deploy_unicode_api.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: deploy unicode-api
name: deploy-unicode-api

on:
push:
Expand All @@ -11,21 +11,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Login to Github Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Bake unicode-api image and push to github container registry
uses: docker/bake-action@v3.1.0
uses: docker/bake-action@v4.1.0
with:
files: ./docker-bake.hcl
targets: unicode-api
push: true
set: unicode-api.args.REDIS_PW=${{ secrets.REDIS_PW }}
- name: Deploy unicode-api docker image to dokku
uses: dokku/github-action@master
with:
Expand Down
40 changes: 20 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
FROM python:3.11

ARG ARG_ENV
ARG ARG_UNICODE_VERSION
ARG ARG_REDIS_HOST
ARG ARG_REDIS_PORT
ARG ARG_REDIS_DB
ARG ARG_REDIS_PW
ARG ARG_RATE_LIMIT_PER_PERIOD
ARG ARG_RATE_LIMIT_PERIOD_SECONDS
ARG ARG_RATE_LIMIT_BURST
ARG ARG_TEST_HEADER
ARG ENV
ARG UNICODE_VERSION
ARG REDIS_HOST
ARG REDIS_PORT
ARG REDIS_DB
ARG REDIS_PW
ARG RATE_LIMIT_PER_PERIOD
ARG RATE_LIMIT_PERIOD_SECONDS
ARG RATE_LIMIT_BURST
ARG TEST_HEADER

ENV ENV=${ARG_ENV}
ENV UNICODE_VERSION=${ARG_UNICODE_VERSION}
ENV REDIS_HOST=${ARG_REDIS_HOST}
ENV REDIS_PORT=${ARG_REDIS_PORT}
ENV REDIS_DB=${ARG_REDIS_DB}
ENV REDIS_PW=${ARG_REDIS_PW}
ENV RATE_LIMIT_PER_PERIOD=${ARG_RATE_LIMIT_PER_PERIOD}
ENV RATE_LIMIT_PERIOD_SECONDS=${ARG_RATE_LIMIT_PERIOD_SECONDS}
ENV RATE_LIMIT_BURST=${ARG_RATE_LIMIT_BURST}
ENV TEST_HEADER=${ARG_TEST_HEADER}
ENV ENV=${ENV}
ENV UNICODE_VERSION=${UNICODE_VERSION}
ENV REDIS_HOST=${REDIS_HOST}
ENV REDIS_PORT=${REDIS_PORT}
ENV REDIS_DB=${REDIS_DB}
ENV REDIS_PW=${REDIS_PW}
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}

WORKDIR /code
RUN pip install -U pip setuptools wheel
Expand Down
20 changes: 10 additions & 10 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ target "unicode-api" {
dockerfile = "./Dockerfile"
tags = ["ghcr.io/a-luna/unicode-api:${GITHUB_SHA}"]
args = {
ARG_ENV = "PROD"
ARG_UNICODE_VERSION = "15.1.0"
ARG_REDIS_HOST = "dokku-redis-vig-cache"
ARG_REDIS_PORT = "6379"
ARG_REDIS_DB = "1"
ARG_REDIS_PW = "${REDIS_PW}"
ARG_RATE_LIMIT_PER_PERIOD = "50"
ARG_RATE_LIMIT_PERIOD_SECONDS = "60"
ARG_RATE_LIMIT_BURST = "10"
ARG_TEST_HEADER = "X-UnicodeAPI-Test"
ENV = "PROD"
UNICODE_VERSION = "15.1.0"
REDIS_HOST = "dokku-redis-vig-cache"
REDIS_PORT = "6379"
REDIS_DB = "1"
REDIS_PW = "${REDIS_PW}"
RATE_LIMIT_PER_PERIOD = "50"
RATE_LIMIT_PERIOD_SECONDS = "60"
RATE_LIMIT_BURST = "10"
TEST_HEADER = "X-UnicodeAPI-Test"
}
}

0 comments on commit cc47a4c

Please sign in to comment.