65 lines
1.7 KiB
Text
65 lines
1.7 KiB
Text
|
|
# Production image for Transaction Bot service
|
||
|
|
# Used in CI for E2E testing - contains all code baked in
|
||
|
|
|
||
|
|
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 services/txnBot/package.json ./services/txnBot/
|
||
|
|
|
||
|
|
# 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 txnBot dependencies (no lock file for txnBot)
|
||
|
|
WORKDIR /app/services/txnBot
|
||
|
|
RUN npm install
|
||
|
|
|
||
|
|
# Copy txnBot source
|
||
|
|
COPY services/txnBot/ ./
|
||
|
|
|
||
|
|
# Copy shared config files
|
||
|
|
WORKDIR /app
|
||
|
|
COPY onchain/deployments*.json ./onchain/
|
||
|
|
|
||
|
|
# Production image
|
||
|
|
FROM node:20-alpine
|
||
|
|
|
||
|
|
RUN apk add --no-cache dumb-init wget bash
|
||
|
|
|
||
|
|
WORKDIR /app
|
||
|
|
|
||
|
|
# Copy built artifacts
|
||
|
|
COPY --from=builder /app/kraiken-lib/dist ./kraiken-lib/dist
|
||
|
|
COPY --from=builder /app/kraiken-lib/package.json ./kraiken-lib/
|
||
|
|
COPY --from=builder /app/services/txnBot ./services/txnBot
|
||
|
|
COPY --from=builder /app/onchain ./onchain
|
||
|
|
|
||
|
|
# Copy entrypoint
|
||
|
|
COPY docker/ci-entrypoints/txnbot-ci-entrypoint.sh /entrypoint.sh
|
||
|
|
RUN chmod +x /entrypoint.sh
|
||
|
|
|
||
|
|
WORKDIR /app/services/txnBot
|
||
|
|
|
||
|
|
ENV NODE_ENV=production
|
||
|
|
ENV HOST=0.0.0.0
|
||
|
|
ENV PORT=43069
|
||
|
|
|
||
|
|
EXPOSE 43069
|
||
|
|
|
||
|
|
HEALTHCHECK --interval=5s --timeout=3s --retries=4 --start-period=10s \
|
||
|
|
CMD wget --spider -q http://127.0.0.1:43069/status || exit 1
|
||
|
|
|
||
|
|
ENTRYPOINT ["dumb-init", "--", "/entrypoint.sh"]
|