From de823e8ec96f0a415b73ecfed11aaeaf4a67a79f Mon Sep 17 00:00:00 2001 From: bachrc <yohann.bacha@bachrc.net> Date: Thu, 17 Oct 2024 17:57:28 +0000 Subject: [PATCH] feat: l'application est packagee avec la bdd --- .github/workflows/deploy-database.yaml | 59 ------------------- .../{deploy-website.yaml => deploy.yaml} | 4 +- Dockerfile | 10 +++- compose.yml | 2 +- 4 files changed, 10 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/deploy-database.yaml rename .github/workflows/{deploy-website.yaml => deploy.yaml} (94%) diff --git a/.github/workflows/deploy-database.yaml b/.github/workflows/deploy-database.yaml deleted file mode 100644 index 2118216..0000000 --- a/.github/workflows/deploy-database.yaml +++ /dev/null @@ -1,59 +0,0 @@ -name: Déploiement de la base de données - -on: - push: - branches: - - main - paths: - - pb_migrations/** - -env: - REGISTRY: ghcr.io - IMAGE_NAME: 'bachrc/de-l-arbre-aux-wc-database' - -permissions: - contents: read - id-token: write - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - attestations: write - id-token: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 - - - name: Log in to the Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - # set latest tag for default branch - type=raw,value=latest,enable={{is_default_branch}} - - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - context: . - push: true - target: database - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/amd64,linux/arm64/v8 diff --git a/.github/workflows/deploy-website.yaml b/.github/workflows/deploy.yaml similarity index 94% rename from .github/workflows/deploy-website.yaml rename to .github/workflows/deploy.yaml index 9cb0f1e..44e7a5a 100644 --- a/.github/workflows/deploy-website.yaml +++ b/.github/workflows/deploy.yaml @@ -1,4 +1,4 @@ -name: Déploiement du site +name: Déploiement de l'application on: push: @@ -7,7 +7,7 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: 'bachrc/de-l-arbre-aux-wc-app' + IMAGE_NAME: 'bachrc/de-l-arbre-aux-wc' permissions: contents: read diff --git a/Dockerfile b/Dockerfile index 757fb7e..f71830b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,11 @@ RUN deno task build FROM base AS database WORKDIR /app COPY ./pb_migrations /home/deno/.local/pb/pb_migrations -CMD ["/home/deno/.local/pb/pocketbase", "serve", "--http=0.0.0.0:8080"] +ENTRYPOINT ["/home/deno/.local/pb/pocketbase", "serve"] +CMD ["--http=0.0.0.0:8080"] -FROM nginx:1-alpine AS app -COPY --from=build /app/build /usr/share/nginx/html \ No newline at end of file +FROM database AS app +RUN mkdir -p /home/deno/.local/pb/pb_public +COPY --from=build /app/build /home/deno/.local/pb/pb_public +ENTRYPOINT ["/home/deno/.local/pb/pocketbase", "serve"] +CMD ["--http=0.0.0.0:8080"] \ No newline at end of file diff --git a/compose.yml b/compose.yml index 4c0281c..ef3b3f7 100644 --- a/compose.yml +++ b/compose.yml @@ -5,7 +5,7 @@ services: ports: - 80:80 environment: - PUBLIC_POCKETBASE_URL: db:8080 + PUBLIC_POCKETBASE_URL: 127.0.0.1:8080 db: image: ghcr.io/bachrc/de-l-arbre-aux-wc-database:latest