diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..476b0b0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,20 @@ +.direnv +.git +.gitea +.idea +.svelte-kit +build +node_modules +pb_data +pb_migrations + +.dockerignore +.envrc +.gitignore + +README.md +flake.lock +flake.nix +formula11.dockerfile +pocketbase.dockerfile +prettier.config.js diff --git a/.gitea/workflows/formula11-docker.yaml b/.gitea/workflows/formula11-docker.yaml new file mode 100644 index 0000000..497b626 --- /dev/null +++ b/.gitea/workflows/formula11-docker.yaml @@ -0,0 +1,25 @@ +name: Build Formula11 Docker Image + +on: + push: + branches: [master] + # paths: + # - ".gitea/workflows/pocketbase-docker.yaml" + # - "pocketbase.dockerfile" + +jobs: + pocketbase-docker: + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Login to container registry + uses: docker/login-action@v3 + with: + registry: gitea.vps.chriphost.de + username: ${{ secrets.CONTAINER_REGISTRY_USER }} + password: ${{ secrets.CONTAINER_REGISTRY_TOKEN }} + - name: Build Pocketbase Docker Image + run: docker build --build-arg PB_VERSION=0.25.0 --file pocketbase.dockerfile --tag gitea.vps.chriphost.de/christoph/pocketbase:0.25.0 . + - name: Push Pocketbase Docker Image + run: docker push gitea.vps.chriphost.de/christoph/pocketbase:0.25.0 diff --git a/formula11.dockerfile b/formula11.dockerfile new file mode 100644 index 0000000..2d94b8a --- /dev/null +++ b/formula11.dockerfile @@ -0,0 +1,27 @@ +# Build the node application +FROM node:23-alpine AS builder + +WORKDIR /app +COPY package*.json ./ + +RUN npm ci + +COPY . . + +RUN npm run build +RUN npm prune --production + +# Copy the built application to a minimal image +FROM node:23-alpine + +WORKDIR /app +COPY --from=builder /app/build build/ +# If all deps are devDependencies, this should theoretically not be required +# COPY --from=builder /app/node_modules node_modules/ +COPY package.json . + +EXPOSE 5173 + +ENV NODE_ENV=production + +CMD [ "node", "build" ]