feature/ci (#84)
Co-authored-by: openhands <openhands@all-hands.dev> Reviewed-on: https://codeberg.org/johba/harb/pulls/84
This commit is contained in:
parent
beefe22f90
commit
4277f19b68
41 changed files with 3149 additions and 298 deletions
78
docker/Dockerfile.webapp-ci
Normal file
78
docker/Dockerfile.webapp-ci
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
# Production image for Web App (Vite + Vue)
|
||||
# Used in CI for E2E testing - contains all code baked in
|
||||
# Includes filesystem symlinks for Vite path resolution in Docker
|
||||
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
RUN apk add --no-cache git bash
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files first for better caching
|
||||
COPY package.json package-lock.json ./
|
||||
COPY kraiken-lib/package.json kraiken-lib/package-lock.json ./kraiken-lib/
|
||||
COPY web-app/package.json web-app/package-lock.json ./web-app/
|
||||
|
||||
# Copy ABI files needed by kraiken-lib
|
||||
COPY onchain/out/Kraiken.sol/Kraiken.json ./onchain/out/Kraiken.sol/
|
||||
COPY onchain/out/Stake.sol/Stake.json ./onchain/out/Stake.sol/
|
||||
|
||||
# Install kraiken-lib dependencies and build
|
||||
WORKDIR /app/kraiken-lib
|
||||
RUN npm ci --ignore-scripts
|
||||
COPY kraiken-lib/ ./
|
||||
RUN ./node_modules/.bin/tsc
|
||||
|
||||
# Install webapp dependencies
|
||||
WORKDIR /app/web-app
|
||||
RUN npm ci
|
||||
|
||||
# Copy webapp source
|
||||
COPY web-app/ ./
|
||||
|
||||
# Production image
|
||||
FROM node:20-alpine
|
||||
|
||||
RUN apk add --no-cache dumb-init wget bash
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy kraiken-lib (src for vite alias, dist for runtime)
|
||||
COPY --from=builder /app/kraiken-lib/src ./kraiken-lib/src
|
||||
COPY --from=builder /app/kraiken-lib/dist ./kraiken-lib/dist
|
||||
COPY --from=builder /app/kraiken-lib/package.json ./kraiken-lib/
|
||||
COPY --from=builder /app/web-app ./web-app
|
||||
|
||||
# Copy ABI files needed by kraiken-lib at compile time
|
||||
COPY --from=builder /app/onchain/out ./onchain/out
|
||||
|
||||
# Create placeholder deployments-local.json for Vite compilation
|
||||
# Actual contract addresses are provided via VITE_* environment variables at runtime
|
||||
RUN mkdir -p /app/onchain && \
|
||||
echo '{"contracts":{}}' > /app/onchain/deployments-local.json
|
||||
|
||||
# Create symlinks so Vite's path resolution works when base (/app/) is a prefix of root (/app/web-app)
|
||||
# Vite's internal removeBase() can strip the /app/ prefix from filesystem paths, producing
|
||||
# /web-app/src/... instead of /app/web-app/src/... — symlinks make both paths valid
|
||||
RUN ln -s /app/web-app /web-app && \
|
||||
ln -s /app/kraiken-lib /kraiken-lib && \
|
||||
ln -s /app/onchain /onchain
|
||||
|
||||
# Copy entrypoint
|
||||
COPY docker/ci-entrypoints/webapp-ci-entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
WORKDIR /app/web-app
|
||||
|
||||
ENV NODE_ENV=development
|
||||
ENV HOST=0.0.0.0
|
||||
ENV PORT=5173
|
||||
# Disable Vue DevTools in CI builds - vite.config.ts checks for CI=true
|
||||
ENV CI=true
|
||||
|
||||
EXPOSE 5173
|
||||
|
||||
HEALTHCHECK --interval=5s --timeout=3s --retries=84 --start-period=15s \
|
||||
CMD wget --spider -q http://127.0.0.1:5173/app/ || exit 1
|
||||
|
||||
ENTRYPOINT ["dumb-init", "--", "/entrypoint.sh"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue