Skip to content

Commit 31e1916

Browse files
committed
fly.io
1 parent 3238073 commit 31e1916

File tree

8 files changed

+106
-82
lines changed

8 files changed

+106
-82
lines changed

.github/workflows/fly-deploy.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
2+
3+
name: Fly Deploy
4+
on:
5+
push:
6+
branches:
7+
- main
8+
jobs:
9+
deploy:
10+
name: Deploy app
11+
runs-on: ubuntu-latest
12+
concurrency: deploy-group # optional: ensure only one action runs at a time
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: superfly/flyctl-actions/setup-flyctl@master
16+
- run: flyctl deploy --remote-only
17+
env:
18+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

.husky/pre-commit

Whitespace-only changes.

Dockerfile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# syntax = docker/dockerfile:1
2+
3+
# Adjust NODE_VERSION as desired
4+
ARG NODE_VERSION=22.9.0
5+
FROM node:${NODE_VERSION}-slim as base
6+
7+
LABEL fly_launch_runtime="Node.js/Prisma"
8+
9+
# Node.js/Prisma app lives here
10+
WORKDIR /app
11+
12+
# Set production environment
13+
ENV NODE_ENV="production"
14+
15+
# Install pnpm
16+
ARG PNPM_VERSION=9.11.0
17+
RUN npm install -g pnpm@$PNPM_VERSION
18+
19+
20+
# Throw-away build stage to reduce size of final image
21+
FROM base as build
22+
23+
# Install packages needed to build node modules
24+
RUN apt-get update -qq && \
25+
apt-get install --no-install-recommends -y build-essential node-gyp openssl pkg-config python-is-python3
26+
27+
# Install node modules
28+
COPY package.json pnpm-lock.yaml ./
29+
RUN pnpm install --frozen-lockfile --prod=false
30+
31+
# Generate Prisma Client
32+
COPY prisma .
33+
RUN npx prisma generate
34+
35+
# Copy application code
36+
COPY . .
37+
38+
# Build application
39+
RUN pnpm run build
40+
41+
# Remove development dependencies
42+
RUN pnpm prune --prod
43+
44+
45+
# Final stage for app image
46+
FROM base
47+
48+
# Install packages needed for deployment
49+
RUN apt-get update -qq && \
50+
apt-get install --no-install-recommends -y chromium chromium-sandbox openssl && \
51+
rm -rf /var/lib/apt/lists /var/cache/apt/archives
52+
53+
# Copy built application
54+
COPY --from=build /app /app
55+
56+
# Start the server by default, this can be overwritten at runtime
57+
EXPOSE 3000
58+
ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/chromium"
59+
CMD [ "pnpm", "run", "start" ]

Dockerfile.dev

Lines changed: 0 additions & 27 deletions
This file was deleted.

Dockerfile.prod

Lines changed: 0 additions & 32 deletions
This file was deleted.

fly.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# fly.toml app configuration file generated for phishdirectory-api on 2024-10-29T00:30:08-04:00
2+
#
3+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+
#
5+
6+
app = 'phishdirectory-api'
7+
primary_region = 'yul'
8+
kill_signal = 'SIGINT'
9+
kill_timeout = '5s'
10+
11+
[build]
12+
13+
[deploy]
14+
release_command = 'npx prisma migrate dev'
15+
16+
[http_service]
17+
internal_port = 3000
18+
force_https = true
19+
auto_stop_machines = 'stop'
20+
auto_start_machines = true
21+
min_machines_running = 0
22+
processes = ['app']
23+
24+
[[vm]]
25+
memory = '1gb'
26+
cpu_kind = 'shared'
27+
cpus = 1

package.json

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,13 @@
1010
"url": "https://jaspermayone.com"
1111
}
1212
],
13-
"packageManager": "[email protected]",
1413
"scripts": {
15-
"preinstall": "npx only-allow pnpm",
1614
"start": "node dist/index.js",
17-
"postinstall": "npx prisma generate && tsc",
1815
"watch-node": "nodemon dist/index.js",
1916
"watch-ts": "tsc -w",
2017
"dev": "nodemon --quiet --watch './**/*.ts' --exec 'ts-node' src/index.ts",
2118
"build": "npx prisma generate && tsc",
22-
"compile": "npx prisma generate && tsc",
23-
"heroku-prebuild": "echo This runs before Heroku installs dependencies.",
24-
"heroku-postbuild": "echo This runs after Heroku installs dependencies, but before Heroku prunes and caches dependencies.",
25-
"heroku-cleanup": "echo This runs after Heroku prunes and caches dependencies.",
26-
"prepare": "husky",
27-
"prisma:docker": "npx prisma generate && npx prisma migrate dev",
28-
"dev:docker": "pnpm prisma:docker && pnpm dev"
19+
"compile": "npx prisma generate && tsc"
2920
},
3021
"keywords": [],
3122
"author": "Jasper Mayone <[email protected]>",
@@ -56,14 +47,12 @@
5647
"@types/node-statsd": "^0.1.6",
5748
"@types/request-ip": "^0.0.41",
5849
"@types/response-time": "^2.3.8",
59-
"husky": "^9.1.4",
6050
"nodemon": "^3.1.4",
6151
"prisma": "^5.18.0",
6252
"typescript": "^5.5.4"
6353
},
6454
"engines": {
6555
"node": "22.x",
66-
"npm": "10.8.2",
67-
"pnpm": "9.5.0"
56+
"npm": "10.8.2"
6857
}
6958
}

pnpm-lock.yaml

Lines changed: 0 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)