add Dockerfile to build astro and pocketbase
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled Details

This commit is contained in:
Guillaume Dorce 2024-01-10 12:33:00 +01:00
parent 23b607b168
commit 045d16b0ab
1 changed files with 43 additions and 0 deletions

43
Dockerfile Normal file
View File

@ -0,0 +1,43 @@
# PocketBase Stage
FROM alpine:latest as pocketbase
ARG PB_VERSION=0.20.5
RUN apk add --no-cache \
unzip \
ca-certificates
# download and unzip PocketBase
ADD https://github.com/pocketbase/pocketbase/releases/download/v${PB_VERSION}/pocketbase_${PB_VERSION}_linux_amd64.zip /tmp/pb.zip
RUN unzip /tmp/pb.zip -d /pb/
# Uncomment if you want to add migrations and hooks
# COPY ./pb_migrations /pb/pb_migrations
# COPY ./pb_hooks /pb/pb_hooks
EXPOSE 8080
# Node Stage
FROM node:20-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable
COPY . /app
WORKDIR /app
FROM base AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build
# Final Stage
FROM pocketbase
# Copy built Node application to a directory in the PocketBase image
COPY --from=build /app/dist /pb/pb_public
# Start PocketBase
CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8080"]