Skip to content

Commit 6de0585

Browse files
committed
feat: Added Docker image release
1 parent 728cd12 commit 6de0585

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

.github/workflows/release.yml

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
tags:
66
- 'v[0-9]+.[0-9]+.[0-9]+'
77

8+
env:
9+
CONTAINER_IMAGE: ghcr.io/embesozzi/${{github.event.repository.name}}
10+
811
jobs:
912
build-upload-release:
1013
runs-on: ubuntu-latest
@@ -13,11 +16,23 @@ jobs:
1316
contents: write
1417
steps:
1518
- uses: actions/checkout@v2
19+
- uses: docker/login-action@v3
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
1624

1725
- name: Get version from tag
1826
id: version
1927
run: echo ::set-output name=number::$(echo $GITHUB_REF | cut -d / -f 3 | cut -d / -f 3 | sed -e 's/^v//')
2028

29+
- name: docker build & push
30+
run: |
31+
docker build --build-arg API_GATEWAY_VERSION=3.7.0-debian --build-arg PLUGIN_OPENFGA_VERSION=${{ steps.version.outputs.number }} -t ${{env.CONTAINER_IMAGE}} .
32+
docker build . -t ${{env.CONTAINER_IMAGE}}:${{ steps.version.outputs.number }} -t ${{env.CONTAINER_IMAGE}}:latest
33+
docker push ${{env.CONTAINER_IMAGE}}:${{ steps.version.outputs.number }}
34+
docker push ${{env.CONTAINER_IMAGE}}:latest
35+
2136
- name: Create changelog text
2237
id: changelog
2338
uses: loopwerk/tag-changelog@v1

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
ARG API_GATEWAY_VERSION=3.7.0-debian
2+
ARG PLUGIN_OPENFGA_VERSION=1.0.0
3+
FROM apache/apisix:${API_GATEWAY_VERSION}
4+
5+
LABEL maintainer="[email protected]"
6+
LABEL version=${PLUGIN_OPENFGA_VERSION}
7+
LABEL org.opencontainers.image.authors="[email protected]"
8+
LABEL org.opencontainers.image.version=${PLUGIN_OPENFGA_VERSION}
9+
LABEL org.opencontainers.image.revision=${PLUGIN_OPENFGA_VERSION}-${API_GATEWAY_VERSION}
10+
LABEL org.opencontainers.image.title="API Gateway integrated with OpenFGA"
11+
LABEL org.opencontainers.image.description="integrated with OpenFGA for FGA"
12+
13+
COPY apisix/plugins/authz-openfga.lua /usr/local/apisix/apisix/plugins/authz-openfga.lua

apisix/plugins/authz-openfga.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ local function authz_model_cache_set(type, key, value, exp)
9494
if err then
9595
log.error("authz_model_cache_set error=", err)
9696
else
97-
log.error("authz_model_cache_set success=", success)
97+
log.debug("authz_model_cache_set success=", success)
9898
end
9999
else
100100
log.error("dict not found=", type)
@@ -181,7 +181,7 @@ local function authorization_model_get(conf)
181181
end
182182

183183
local authz_model = json_authz_models.authorization_models[1]
184-
core.log.error("first authz model id: ", authz_model.id)
184+
core.log.debug("first authz model id: ", authz_model.id)
185185
authorization_model_json = {
186186
store_id = store.id,
187187
authorization_model_id = authz_model.id
@@ -269,11 +269,11 @@ function _M.access(conf, ctx)
269269
end
270270

271271
if not data.allowed then
272-
log.error("user " .. user_jwt_claim_value .. " not authorized")
272+
log.info("user " .. user_jwt_claim_value .. " not authorized")
273273
return 403, {message = "not authorized"}
274274
end
275275

276-
core.log.debug("user " .. user_jwt_claim_value .. " is allowed")
276+
core.log.info("user " .. user_jwt_claim_value .. " is allowed")
277277
end
278278

279279
return _M

0 commit comments

Comments
 (0)