commit 09eab1c8bd960cb89b58b7d443af30d39519db21 Author: Lucilio Correia Date: Sun Mar 8 23:04:56 2026 -0300 directus oidc diff --git a/.gitea/workflow/deploy.yml b/.gitea/workflow/deploy.yml new file mode 100644 index 0000000..fd52d89 --- /dev/null +++ b/.gitea/workflow/deploy.yml @@ -0,0 +1,16 @@ +name: Deploy to CapRover +on: + push: + branches: [ main ] + +jobs: + build-and-deploy: + runs-on: ubuntu-latest # ou o label do seu runner + steps: + - uses: actions/checkout@v3 + - name: Deploy to CapRover + uses: caprover/deploy-from-github@v1.0.1 + with: + server: ${{ secrets.CAPROVER_SERVER }} + app: 'meu-directus' + token: ${{ secrets.CAPROVER_APP_TOKEN }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5d90c26 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM directus/directus:11 + +USER root +RUN apk add --no-cache openssl + +USER node +RUN npm install directus-extension-openid-connect-provider + +COPY --chown=node:node ./docker-entrypoint-oidc.sh /usr/local/bin/docker-entrypoint-oidc.sh +RUN chmod +x /usr/local/bin/entrypoint-custom.sh + +ENTRYPOINT ["docker-entrypoint-oidc.sh"] +CMD ["npx", "directus", "start"] \ No newline at end of file diff --git a/captain-definition b/captain-definition new file mode 100644 index 0000000..04859b5 --- /dev/null +++ b/captain-definition @@ -0,0 +1,4 @@ +{ + "schemaVersion": 2, + "dockerfilePath": "./Dockerfile" +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..eca34e2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,18 @@ +services: + directus: + build: . + ports: + - "8055:8055" + environment: + KEY: "uma-chave-aleatoria" + SECRET: "um-segredo-aleatoria" + DB_CLIENT: "sqlite3" + DB_FILENAME: "/directus/database/data.db" + # Configurações da Extensão (Baseadas na doc da directus-extension-auth) + OIDC_ISSUER: "http://localhost:8055" + OIDC_PRIVATE_KEY_PATH: "/directus/oidc_private.key" + # Exemplo de Client para o Grist + OIDC_CLIENTS: '[{"id":"grist","secret":"secret-do-grist","redirect_uris":["http://localhost:8484/oauth2/callback"]}]' + volumes: + - ./database:/directus/database + - ./uploads:/directus/uploads \ No newline at end of file diff --git a/docker-entrypoint-oidc.sh b/docker-entrypoint-oidc.sh new file mode 100644 index 0000000..33d5723 --- /dev/null +++ b/docker-entrypoint-oidc.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# Se a variável de ambiente existir, cria o arquivo de chave +if [ ! -z "$OIDC_PRIVATE_KEY" ]; then + echo "Injetando OIDC Private Key..." + echo "$OIDC_PRIVATE_KEY" > /directus/oidc_private.key +fi + +# Executa o comando original (o CMD do Dockerfile) +/usr/local/bin/docker-entrypoint.sh "$@" \ No newline at end of file