Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
build: Create r2 artefact instead of Docker (#3205)
Ivan Starkovb965f33eb584
diff --git a/.dockerignore b/.dockerignoredeleted file mode 100644index 8c846bb5ad..0000000000--- a/.dockerignore+++ /dev/null@@ -1,61 +0,0 @@-# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.--# dependencies-node_modules-.pnp-.pnp.js-yarn.lock--# testing-coverage--# remix-build-_build-.cache-.vercel-.output-.netlify--# misc-.DS_Store-*.pem-/.idea--# logs-npm-debug.log*-yarn-debug.log*-yarn-error.log*-.pnpm-debug.log*--# local env files-.env-.env.local-.env.development.local-.env.test.local-.env.production.local--# turbo-.turbo--# data-/data-*.db-*.db-journal--# migrations-**/prisma/migrations/lockfile-**/prisma/migrations/*/client--# builds-packages/**/lib-generated-storybook-static-tsconfig.tsbuildinfo--# to save thunder https://marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client files-.thunder-.env*.local--# wrangler builds-distdiff --git a/.github/workflows/cli-docker.yaml b/.github/workflows/cli-docker.yamldeleted file mode 100644index e33173ffed..0000000000--- a/.github/workflows/cli-docker.yaml+++ /dev/null@@ -1,67 +0,0 @@-name: CLI Docker--on:- push:- branches:- - "*.staging"--# cancel in-progress runs on new commits to same PR (gitub.event.number)-concurrency:- group: vercel-deploy-${{ github.workflow }}-${{ github.event.number || github.sha }}- cancel-in-progress: true--permissions:- contents: read # to fetch code (actions/checkout)- statuses: write # This is required for the GitHub Script createCommitStatus to work- packages: write--jobs:- build:- environment:- name: "staging"-- timeout-minutes: 20-- runs-on: ubuntu-latest-- steps:- - uses: actions/checkout@v3- with:- ref: ${{ github.event.pull_request.head.sha || github.sha }} # HEAD commit instead of merge commit-- - name: Set up Docker Buildx- uses: docker/setup-buildx-action@v3-- - name: Login to Docker Hub- uses: docker/login-action@v3- with:- registry: ghcr.io- username: ${{ github.repository_owner }}- password: ${{ secrets.GITHUB_TOKEN }}-- # username: ${{ secrets.DOCKERHUB_USER }}- # password: ${{ secrets.DOCKERHUB_TOKEN }}-- # To be able to pull image by branh name, sha, short sha and tag- # i.e. olegisonen/webstudio:hello.staging- - name: Docker meta- id: meta- uses: docker/metadata-action@v5- with:- # TODO: create team someday on dockerhub- images: |- ghcr.io/webstudio-is/webstudio- tags: |- type=sha,format=long- type=sha,format=short- type=ref,event=branch- type=ref,event=tag-- - name: Build and push- uses: docker/build-push-action@v5- with:- context: .- file: ./devops/cli/Dockerfile- push: true- tags: ${{ steps.meta.outputs.tags }}- labels: ${{ steps.meta.outputs.labels }}diff --git a/.github/workflows/cli-r2.yaml b/.github/workflows/cli-r2.yamlnew file mode 100644index 0000000000..ee5e602531--- /dev/null+++ b/.github/workflows/cli-r2.yaml@@ -0,0 +1,125 @@+name: CLI R2++on:+ push:+ branches:+ - "*.staging"++# cancel in-progress runs on new commits to same PR (gitub.event.number)+concurrency:+ group: vercel-cli-r2-${{ github.workflow }}-${{ github.event.number || github.sha }}+ cancel-in-progress: true++permissions:+ contents: read # to fetch code (actions/checkout)+ statuses: write # This is required for the GitHub Script createCommitStatus to work+ packages: write++jobs:+ build:+ env:+ COMPATIBILITY_DATE: 2024-04-10++ environment:+ name: "staging"++ runs-on: ubuntu-latest++ steps:+ - uses: actions/checkout@v3+ with:+ ref: ${{ github.sha }} # HEAD commit instead of merge commit++ - uses: pnpm/[email protected]++ - uses: actions/setup-node@v3+ with:+ node-version: "18.x"+ cache: pnpm++ - name: pnpm instal+ run: pnpm install --ignore-scripts++ - name: pnpm build+ run: pnpm --filter 'webstudio-cloudlfare-template^...' run build++ # Ideally, execute 'pnpm deploy --prod', but @remix-run/dev doesn't support this flag.+ # Despite being listed as a dependency, @remix-run/dev does not install the remix cli.+ # TODO: Minimize artefact size due to frequent downloads on each publish.+ - name: pnpm deploy+ run: pnpm --filter 'webstudio-cloudlfare-template' deploy "${{ github.workspace }}/../cloudlfare-template"++ - name: Make archive+ run: |+ tar --use-compress-program="zstd -19" -cf cloudlfare-template.tar.zst cloudlfare-template+ working-directory: ${{ github.workspace }}/..++ - name: Copy artifact+ run: |+ curl https://rclone.org/install.sh | sudo bash++ ls -la++ # For staging+ rclone copyto -P -M \+ --no-check-dest \+ cloudlfare-template.tar.zst "r2:/${ARTEFACT_BUCKET_NAME}/public/cloudlfare-template/${{ github.ref_name }}.tar.zst"++ # For production+ rclone copyto -P -M \+ --no-check-dest \+ cloudlfare-template.tar.zst "r2:/${ARTEFACT_BUCKET_NAME}/public/cloudlfare-template/${{ github.sha }}.tar.zst"++ working-directory: ${{ github.workspace }}/..+ env:+ RCLONE_CONFIG_R2_ACCESS_KEY_ID: ${{ secrets.RCLONE_CONFIG_R2_ACCESS_KEY_ID }}+ RCLONE_CONFIG_R2_ACL: ${{ secrets.RCLONE_CONFIG_R2_ACL }}+ RCLONE_CONFIG_R2_ENDPOINT: ${{ secrets.RCLONE_CONFIG_R2_ENDPOINT }}+ RCLONE_CONFIG_R2_PROVIDER: ${{ secrets.RCLONE_CONFIG_R2_PROVIDER }}+ RCLONE_CONFIG_R2_TYPE: ${{ secrets.RCLONE_CONFIG_R2_TYPE }}+ RCLONE_CONFIG_R2_SECRET_ACCESS_KEY: ${{ secrets.RCLONE_CONFIG_R2_SECRET_ACCESS_KEY }}+ ARTEFACT_BUCKET_NAME: ${{ secrets.ARTEFACT_BUCKET_NAME }}++ checks:+ environment:+ name: "staging"++ runs-on: ubuntu-latest++ needs: build++ steps:+ - uses: pnpm/[email protected]+ with:+ version: "9"++ - uses: actions/setup-node@v3+ with:+ node-version: "18.x"++ - name: Copy atrifact via http+ run: curl -o cloudlfare-template.tar.zst ${{ secrets.ARTEFACT_BUCKET_URL }}/public/cloudlfare-template/${{ github.ref_name }}.tar.zst++ - name: Extract archive+ run: tar --use-compress-program="zstd -d" -xf cloudlfare-template.tar.zst -C .++ - name: Webstudio Build+ run: pnpm webstudio build --template internal --template saas-helpers --template cloudflare --assets false+ working-directory: ${{ github.workspace }}/cloudlfare-template++ - name: Remix Build+ run: pnpm build+ working-directory: ${{ github.workspace }}/cloudlfare-template++ - name: WRANGLER Build+ run: |+ NODE_ENV=production pnpm wrangler deploy \+ --name build \+ --compatibility-date '${COMPATIBILITY_DATE}' \+ --minify true \+ --logpush true \+ --dry-run \+ --outdir dist \+ './functions/[[path]].ts'++ working-directory: ${{ github.workspace }}/cloudlfare-templatediff --git a/devops/cli/Dockerfile b/devops/cli/Dockerfiledeleted file mode 100644index cf896950ee..0000000000--- a/devops/cli/Dockerfile+++ /dev/null@@ -1,83 +0,0 @@-# 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 --filter 'webstudio-cloudlfare-template^...' 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