Skip to content

Commit 217ff55

Browse files
committed
fix stupid bug
1 parent a146f43 commit 217ff55

File tree

8 files changed

+1941
-247
lines changed

8 files changed

+1941
-247
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 }}

Dockerfile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# syntax = docker/dockerfile:1
2+
3+
# Adjust NODE_VERSION as desired
4+
ARG NODE_VERSION=22.11.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.9.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 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+
CMD [ "pnpm", "run", "start" ]

fly.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# fly.toml app configuration file generated for api-dark-brook-8284 on 2025-01-12T16:05:59-05:00
2+
#
3+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+
#
5+
6+
app = 'api-dark-brook-8284'
7+
primary_region = 'ewr'
8+
9+
[build]
10+
11+
[deploy]
12+
release_command = 'npx prisma migrate deploy'
13+
14+
[http_service]
15+
internal_port = 3000
16+
force_https = true
17+
auto_stop_machines = 'stop'
18+
auto_start_machines = true
19+
min_machines_running = 0
20+
processes = ['app']
21+
22+
[[vm]]
23+
memory = '1gb'
24+
cpu_kind = 'shared'
25+
cpus = 1

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"ts-node": "^10.9.2"
4242
},
4343
"devDependencies": {
44+
"@flydotio/dockerfile": "^0.6.1",
4445
"@types/bcrypt": "^5.0.2",
4546
"@types/express": "^4.17.21",
4647
"@types/jsonwebtoken": "^9.0.7",

0 commit comments

Comments
 (0)