-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
122 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Déploiement de la base de données | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- pb_migrations/** | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read # required for publishing Docker images | ||
packages: write # required for pushing Docker images | ||
|
||
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: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
target: database | ||
tags: database:latest | ||
platforms: linux/amd64,linux/arm64/v8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Déploiement du site | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read # required for publishing Docker images | ||
packages: write # required for pushing Docker images | ||
|
||
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: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
target: app | ||
tags: app:latest | ||
platforms: linux/amd64,linux/arm64/v8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,32 @@ | ||
FROM denoland/deno:2.0.0 AS base | ||
|
||
FROM base AS dev | ||
ARG PB_VERSION=0.22.21 | ||
ARG ARCH=arm64 | ||
|
||
USER root | ||
RUN mkdir -p /home/deno && chown -R deno:deno /home/deno | ||
RUN apt update && apt install -y git sudo | ||
RUN apt update && apt install -y git sudo unzip | ||
RUN echo "deno ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers | ||
|
||
USER deno | ||
RUN mkdir -p /home/deno/.local/bin | ||
ENV PATH=$PATH:/home/deno/.local/bin | ||
COPY --from=elestio/pocketbase --chown=deno:deno /usr/local/bin/pocketbase /home/deno/.local/bin/pocketbase | ||
# download and unzip PocketBase | ||
RUN mkdir -p /home/deno/.local/pb | ||
ENV PATH=$PATH:/home/deno/.local/pb | ||
ADD --chown=deno:deno https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_${ARCH}.zip /tmp/pb.zip | ||
RUN unzip /tmp/pb.zip -d /home/deno/.local/pb/ | ||
|
||
FROM base AS build | ||
WORKDIR /app | ||
USER deno | ||
COPY --chown=deno:deno package.json deno.lock . | ||
RUN deno install --allow-scripts | ||
COPY --chown=deno:deno . . | ||
RUN deno task build | ||
|
||
FROM base AS database | ||
WORKDIR /app | ||
COPY ./pb_migrations /app/pb_migrations | ||
CMD "pocketbase serve" | ||
|
||
FROM nginx:1-alpine AS app | ||
COPY --from=build /app/build /usr/share/nginx/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import PocketBase from 'pocketbase'; | ||
import { PUBLIC_POCKETBASE_URL } from '$env/static/public'; | ||
|
||
export const pb = new PocketBase('http://127.0.0.1:8090'); | ||
export const pb = new PocketBase(PUBLIC_POCKETBASE_URL); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,21 @@ | ||
<script lang="ts"> | ||
import { pb } from '$lib/database'; | ||
import { currentUser } from '$lib/login.svelte'; | ||
pb.collection('users').authRefresh(); | ||
</script> | ||
|
||
<div class="p-2"> | ||
<h1 class="text-2xl">Profil</h1> | ||
<div class="flex flex-col gap-4"> | ||
<div class="flex flex-col"> | ||
<span class="text-xs font-bold">Nom</span> | ||
<span>{currentUser.value.name}</span> | ||
<span>{currentUser.value?.name}</span> | ||
</div> | ||
<div class="flex flex-col"> | ||
<span class="text-xs font-bold">Pseudonyme</span> | ||
<span>{currentUser.value.username}</span> | ||
<span>{currentUser.value?.username}</span> | ||
</div> | ||
<div class="flex flex-col"> | ||
<span class="text-xs font-bold">Adresse mail</span> | ||
<span>{currentUser.value.email}</span> | ||
<span>{currentUser.value?.email}</span> | ||
</div> | ||
</div> | ||
</div> |