mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-06 20:13:35 +09:00
## Description 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory
83 lines
2.8 KiB
Docker
83 lines
2.8 KiB
Docker
# Container image that runs your code
|
|
# Execute from the root of the repository:
|
|
# docker build -t docker-cli -f ./devops/cli/Dockerfile . --progress=plain
|
|
# docker run --rm -it docker-cli sh
|
|
# docker run --rm -it --env-file <(infisical export --format=dotenv --path='/GITHUB_SAAS' --env=dev | while IFS= read -r line; do eval "echo $line"; done) docker-cli rclone copy -P -M --no-check-dest --header "Cache-Control: public,max-age=31536004,immutable" '/cli/package.json' 'r2:/build-artifacts'
|
|
FROM node:18.20-alpine3.18 as build
|
|
|
|
ENV CI=true
|
|
ENV SKIP_INSTALL_SIMPLE_GIT_HOOKS=true
|
|
ENV PRISMA_SKIP_POSTINSTALL_GENERATE=true
|
|
|
|
COPY ./ /webstudio
|
|
WORKDIR /webstudio
|
|
|
|
ENV PNPM_HOME="/.pnpm/store"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
RUN corepack enable pnpm && mkdir -p $PNPM_HOME
|
|
RUN pnpm install --ignore-scripts
|
|
RUN pnpm -r --filter './packages/*' run build
|
|
RUN pnpm --filter 'webstudio-cloudlfare-template' deploy /cloudlfare-template
|
|
|
|
WORKDIR /cloudlfare-template
|
|
|
|
RUN \
|
|
find . -name 'typescript@*' -type d -prune -exec rm -rf '{}' + && \
|
|
# find . -name 'workerd*' -type f -prune -exec rm -rf '{}' + && \
|
|
find . -name '@storybook*' -type d -prune -exec rm -rf '{}' + && \
|
|
find . -name 'eslint@*' -type d -prune -exec rm -rf '{}' + && \
|
|
find . -name '@types+node@*' -type d -prune -exec rm -rf '{}' + && \
|
|
find . -name '@cloudflare+workers-types@*' -type d -prune -exec rm -rf '{}' +
|
|
# find . -name 'wrangler@*' -type d -prune -exec rm -rf '{}' +
|
|
|
|
ENV COMPATIBILITY_DATE=2024-04-10
|
|
|
|
RUN \
|
|
pnpm webstudio build --template internal --template saas-helpers --template cloudflare --assets false && \
|
|
pnpm build && \
|
|
NODE_ENV=production pnpm wrangler deploy \
|
|
--name build \
|
|
--compatibility-date '${COMPATIBILITY_DATE}' \
|
|
--minify true \
|
|
--logpush true \
|
|
--dry-run \
|
|
--outdir dist \
|
|
'./functions/[[path]].ts'
|
|
|
|
RUN rm -rf dist && rm -rf build && rm -rf .wrangler
|
|
|
|
FROM node:18.20-alpine3.18 as cloudflare-template
|
|
|
|
ENV PNPM_HOME="/.pnpm/store"
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
|
ENV COMPATIBILITY_DATE=2024-04-10
|
|
ENV CI=true
|
|
|
|
RUN \
|
|
corepack enable pnpm && mkdir -p $PNPM_HOME && \
|
|
apk update && apk add bash curl rclone postgresql14-client --no-cache && \
|
|
pnpm i -g --prod zx
|
|
|
|
# && pnpm i -g --prod wrangler
|
|
# && find / -name 'workerd*' -type f -prune -exec rm -rf '{}' +
|
|
|
|
COPY --from=build /cloudlfare-template /cloudlfare-template
|
|
|
|
WORKDIR /cloudlfare-template
|
|
|
|
# RUN \
|
|
# pnpm webstudio build --template internal --template saas-helpers --template cloudflare --assets false && \
|
|
# pnpm build && \
|
|
# NODE_ENV=production wrangler deploy \
|
|
# --name build \
|
|
# --compatibility-date ${COMPATIBILITY_DATE} \
|
|
# --minify true \
|
|
# --logpush true \
|
|
# --dry-run \
|
|
# --outdir dist \
|
|
# './functions/[[path]].ts'
|
|
#
|
|
# # Clean up
|
|
# RUN rm -rf dist && rm -rf build && rm -rf .wrangler
|
|
|
|
# TODO: Layered build, production deps only |