diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 17565e1..d88f589 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,11 +5,11 @@ "context": "..", "target": "base" }, - "remoteUser": "deno", + "remoteUser": "wizou", "mounts": [ "source=${localWorkspaceFolderBasename}-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume" ], - "postCreateCommand": "sudo chown deno:deno node_modules && deno install --allow-scripts=npm:@sveltejs/kit", + "postCreateCommand": "sudo chown wizou:wizou node_modules && deno install --allow-scripts=npm:@sveltejs/kit", "customizations": { "vscode": { "extensions": [ diff --git a/Dockerfile b/Dockerfile index d2c8c53..bacdf62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,37 +1,47 @@ -FROM denoland/deno:2.0.0 AS base +FROM debian:12-slim AS base ARG PB_VERSION=0.22.21 ARG ARCH=arm64 +ARG UID=1000 +ARG GID=1000 USER root -RUN mkdir -p /home/deno && chown -R deno:deno /home/deno +RUN groupadd -g $GID -o wizou +RUN useradd -m -u $UID -g $GID -o -s /bin/bash wizou RUN apt update && apt install -y git sudo unzip -RUN echo "deno ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +RUN echo "wizou ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +RUN mkdir /app && mkdir /pb && chown -R wizou:wizou /app && chown -R wizou:wizou /pb -USER deno +USER wizou # 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/ +ENV PATH=$PATH:/pb +ADD --chown=wizou:wizou 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 /pb/ + +# download deno +RUN mkdir -p /home/wizou/.local/bin +ENV PATH=$PATH:/home/wizou/.local/bin +COPY --from=denoland/deno:bin-2.0.2 --chown=wizou:wizou /deno /home/wizou/.local/bin + FROM base AS build ARG PUBLIC_POCKETBASE_URL WORKDIR /app -USER deno -COPY --chown=deno:deno package.json deno.lock . +USER wizou +COPY --chown=wizou:wizou package.json deno.lock . RUN deno install --allow-scripts -COPY --chown=deno:deno . . +COPY --chown=wizou:wizou . . RUN deno task build FROM base AS database WORKDIR /app -COPY ./pb_migrations /home/deno/.local/pb/pb_migrations -ENTRYPOINT ["/home/deno/.local/pb/pocketbase", "serve"] +COPY ./pb_migrations /pb/pb_migrations +ENTRYPOINT ["/pb/pocketbase", "serve"] CMD ["--http=0.0.0.0:8080"] FROM database AS app -RUN mkdir -p /home/deno/.local/pb/pb_public && mkdir -p /home/deno/.local/pb/pb_data -COPY --from=build /app/build /home/deno/.local/pb/pb_public -ENTRYPOINT ["/home/deno/.local/pb/pocketbase", "serve"] +RUN mkdir -p /pb/pb_public && mkdir -p /pb/pb_data +COPY --from=build /app/build /pb/pb_public + +ENTRYPOINT ["/pb/pocketbase", "serve"] CMD ["--http=0.0.0.0:8080"] \ No newline at end of file diff --git a/deno.lock b/deno.lock index e47b209..b250047 100644 --- a/deno.lock +++ b/deno.lock @@ -20,7 +20,8 @@ "npm:tailwindcss@^3.4.13": "3.4.14_postcss@8.4.47", "npm:typescript-eslint@8": "8.10.0_@typescript-eslint+parser@8.10.0__eslint@9.13.0__typescript@5.6.3_eslint@9.13.0_typescript@5.6.3", "npm:typescript@5": "5.6.3", - "npm:vite@^5.4.9": "5.4.9" + "npm:vite@^5.4.9": "5.4.9", + "npm:zod@^3.23.8": "3.23.8" }, "npm": { "@alloc/quick-lru@5.2.0": { @@ -1589,6 +1590,9 @@ }, "zimmerframe@1.1.2": { "integrity": "sha512-rAbqEGa8ovJy4pyBxZM70hg4pE6gDgaQ0Sl9M3enG3I0d6H4XSAM3GeNGLKnsBpuijUow064sf7ww1nutC5/3w==" + }, + "zod@3.23.8": { + "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==" } }, "workspace": {