Files
webstudio/devops/cli/Dockerfile
T
Ivan Starkov a2e9e472a3 build: Stage publish (#3170)
## 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
2024-04-15 12:58:52 +03:00

47 lines
1.4 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
ENV CI=true
ENV SKIP_INSTALL_SIMPLE_GIT_HOOKS=true
ENV PRISMA_SKIP_POSTINSTALL_GENERATE=true
RUN apk update && apk add bash curl rclone postgresql14-client --no-cache
COPY ./ /cli
WORKDIR /cli
ENV PNPM_HOME="/.pnpm/store"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable pnpm && mkdir -p $PNPM_HOME
RUN pnpm i -g zx
# Install deps, build cli
RUN pnpm install --ignore-scripts
RUN pnpm -r --filter './packages/*' run build
# Test build is working
ENV COMPATIBILITY_DATE=2024-04-10
WORKDIR /cli/fixtures/webstudio-cloudlfare-template
RUN \
pnpm fixtures:build && \
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'
# Clean up
RUN rm -rf dist && rm -rf build && rm -rf .wrangler
# TODO: Layered build, production deps only