initial
This commit is contained in:
46
Dockerfile.client
Normal file
46
Dockerfile.client
Normal file
@@ -0,0 +1,46 @@
|
||||
FROM node:18-alpine AS base
|
||||
WORKDIR /app
|
||||
RUN yarn global add turbo@1.5.5
|
||||
|
||||
FROM base AS pruner
|
||||
COPY . .
|
||||
RUN test -f package.json
|
||||
RUN turbo prune --scope=client --docker
|
||||
|
||||
# Add lockfile and package.json's of isolated subworkspace
|
||||
FROM base AS deps
|
||||
COPY --link --from=pruner /app/out/json/ .
|
||||
COPY --link --from=pruner /app/out/yarn.lock ./yarn.lock
|
||||
RUN yarn install --frozen-lockfile
|
||||
COPY --from=pruner /app/out/full .
|
||||
|
||||
FROM deps AS builder-cloudflare
|
||||
ENV NITRO_PRESET=cloudflare-pages
|
||||
RUN turbo run build --scope=client
|
||||
|
||||
FROM node:18-alpine AS deployer-cloudflare
|
||||
WORKDIR /app
|
||||
RUN npm install --global wrangler
|
||||
COPY --link --from=builder-cloudflare /app/apps/client/dist /app/dist
|
||||
ARG GIT_BRANCH="main" \
|
||||
GIT_COMMIT="" \
|
||||
CF_PAGES_PROJECT="app-prgms-io"
|
||||
RUN --mount=type=secret,id=cloudflare-account-id,target=/kaniko/cloudflare-account-id \
|
||||
--mount=type=secret,id=cloudflare-api-token,target=/kaniko/cloudflare-api-token \
|
||||
CLOUDFLARE_ACCOUNT_ID=$(cat /kaniko/cloudflare-account-id) \
|
||||
CLOUDFLARE_API_TOKEN=$(cat /kaniko/cloudflare-api-token) \
|
||||
wrangler pages deploy \
|
||||
--project-name "${CF_PAGES_PROJECT}" \
|
||||
--branch "${GIT_BRANCH}" \
|
||||
--commit-hash "${GIT_COMMIT}" \
|
||||
dist
|
||||
|
||||
FROM deps AS builder-nodejs
|
||||
ENV NITRO_PRESET=node-server
|
||||
RUN turbo run build --scope=client
|
||||
|
||||
FROM node:18-alpine AS runner-nodejs
|
||||
WORKDIR /app
|
||||
COPY --from=builder-nodejs /app/apps/client/.output /app
|
||||
EXPOSE 3000
|
||||
CMD [ "node", "./server/index.mjs" ]
|
||||
Reference in New Issue
Block a user