Skip to content

Commit

Permalink
Merge pull request #19 from ponder-surveys/feature/pon-816-move-farca…
Browse files Browse the repository at this point in the history
…ster-survey-bot-to-railway

removed yarn, added dockerfile for railway
  • Loading branch information
erik-rt authored Oct 21, 2024
2 parents 937d9d9 + 088c66d commit 47a62b4
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 11,691 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
.env
.git
.gitignore
README.md
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ yarn-error.log*
!.yarn/releases
!.yarn/sdks
!.yarn/versions

bun.lockb
823 changes: 0 additions & 823 deletions .yarn/releases/yarn-3.3.1.cjs

This file was deleted.

3 changes: 0 additions & 3 deletions .yarnrc.yml

This file was deleted.

51 changes: 51 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Use the official Bun image
FROM oven/bun:1 as base

# Set the working directory
WORKDIR /app

# Copy package.json and bun.lockb (if exists)
COPY package.json bun.lockb* ./

# Install dependencies
RUN bun install --frozen-lockfile

# Copy the rest of the application code
COPY . .

# Build the application
RUN bun run build

# Define environment variables
ARG NEYNAR_API_KEY
ARG NEYNAR_SIGNER_UUID
ARG NEYNAR_POLL_SIGNER_UUID
ARG SUPABASE_URL
ARG SUPABASE_KEY
ARG SENTRY_DSN
ARG SENTRY_ENVIRONMENT
ARG WEB3_ENGINE_URL
ARG WEB3_ACCESS_TOKEN
ARG TRANSACTION_ADDRESS
ARG ALCHEMY_API_KEY
ARG EDGE_FUNCTIONS_SERVER_URL
ARG EDGE_FUNCTIONS_SECRET_TOKEN
ARG FRAME_API_URL
ARG APP_URL
ARG WARPCAST_API_KEY
ARG NEXT_GENERAL_QUESTION_CRON
ARG NEXT_COMMUNITY_QUESTION_CRON
ARG NEXT_EXPEDITED_QUESTION_CRON
ARG NEXT_QUESTION_REPLY
ARG NEXT_QUESTION_INFO
ARG NEXT_POLL_RESULTS_CRON
ARG NEXT_POLL_RESULTS_INTERVAL_HOURS
ARG NEXT_PREDICTIVE_POLL_RESULTS_CRON
ARG NEXT_QUESTION_QUAL_UPDATE_CRON
ARG NEXT_QUESTION_QUAL_UPDATE_INTERVAL_HOURS
ARG CALL_TO_ACTION
ARG RESULTS_CALL_TO_ACTION
ARG LOG_LEVEL

# Start the application
CMD ["bun", "run", "./dist/app.js"]
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"author": "benadamsky <benadamsky@gmail.com>",
"license": "MIT",
"scripts": {
"start": "tsc-watch --skipLibCheck --onSuccess 'node dist/app.js'",
"build": "tsc --skipLibCheck",
"start": "bun run --watch src/app.ts",
"build": "bun build ./src/app.ts --target node --outdir ./dist",
"prettier": "prettier --config .prettierrc '*/**/*.{js,ts}' --write",
"lint": "yarn prettier && eslint --max-warnings 0 --ext ts,tsx,json src"
"lint": "bun run prettier && eslint --max-warnings 0 --ext ts,tsx,json src"
},
"dependencies": {
"@neynar/nodejs-sdk": "^1.20.1",
Expand All @@ -21,7 +21,6 @@
"@thirdweb-dev/sdk": "^4.0.36",
"axios": "^1.6.0",
"cron-parser": "^4.8.1",
"dotenv": "^16.0.3",
"ethers": "^5",
"node-cron": "^3.0.2",
"pino": "^9.4.0",
Expand All @@ -38,6 +37,7 @@
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^5.49.0",
"@typescript-eslint/parser": "^5.49.0",
"bun-types": "^1.1.31",
"eslint": "^8.32.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-import": "^2.27.5",
Expand All @@ -48,6 +48,5 @@
"prettier": "^2.8.3",
"tsc-watch": "^6.0.0",
"typescript": "^5.6.2"
},
"packageManager": "yarn@3.3.1"
}
}
10 changes: 3 additions & 7 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import * as dotenv from 'dotenv'
dotenv.config()

import {
schedulePollResults,
schedulePredictivePollResults,
Expand All @@ -10,11 +7,10 @@ import { getDateTag } from './utils/getDateTag'

console.log(`${getDateTag()} Surveying the casters...`)

const nextPollResultsTime = process.env.NEXT_POLL_RESULTS_CRON as string
const nextPredictivePollResultsTime = process.env
const nextPollResultsTime = Bun.env.NEXT_POLL_RESULTS_CRON as string
const nextPredictivePollResultsTime = Bun.env
.NEXT_PREDICTIVE_POLL_RESULTS_CRON as string
const nextQuestionUQualTime = process.env
.NEXT_QUESTION_QUAL_UPDATE_CRON as string
const nextQuestionUQualTime = Bun.env.NEXT_QUESTION_QUAL_UPDATE_CRON as string

// Poll for results
schedulePollResults(nextPollResultsTime)
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
"target": "es2018",
"lib": ["es2018", "dom", "ES2021.String"],
"moduleResolution": "node",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"sourceMap": true,
"outDir": "dist",
"baseUrl": "src",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strict": true
"strict": true,
"types": ["bun-types"]
},
"include": ["**/*.ts", "**/*.tsx"]
}
Loading

0 comments on commit 47a62b4

Please sign in to comment.