Skip to content

Commit

Permalink
deploy fly
Browse files Browse the repository at this point in the history
  • Loading branch information
nichtsam committed Dec 23, 2024
1 parent 83f6d28 commit ae274ca
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.git
.gitignore

Dockerfile
.dockerignore

# gitignore
.vscode
node_modules
/.cache
/build
.env
/local
*.local.*
18 changes: 18 additions & 0 deletions .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

name: Fly Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
FROM node:20-slim AS base

RUN apt-get update
RUN apt-get -y install ca-certificates
RUN corepack use pnpm@9
RUN corepack enable pnpm

FROM base AS deps

WORKDIR /app

COPY package.json pnpm-lock.yaml ./
RUN pnpm install

FROM deps AS prod-deps

RUN pnpm prune --prod

FROM deps AS build

COPY . .

RUN pnpm build

FROM base

ENV NODE_ENV production
ENV PORT 3000
EXPOSE 3000

WORKDIR /app

COPY --from=prod-deps /app/node_modules /app/node_modules
COPY --from=build /app/build /app/build
# COPY --from=build /app/public /app/public
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/server.js /app/server.js
COPY --from=build /app/server-utils.js /app/server-utils.js

CMD [ "pnpm","start" ]
19 changes: 19 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# fly.toml app configuration file generated for polyglotize on 2024-12-23T17:26:18+08:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'polyglotize'
primary_region = 'hkg'
swap_size_mb = 512

[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true

[[vm]]
cpu_kind = 'shared'
cpus = 1
memory_mb = 256
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"name": "polyglotize",
"author": "Samuel Jensen",
"license": "MIT",
"engines": {
"node": "20",
"pnpm": "9"
},
"imports": {
"#app/*": "./app/*"
},
Expand Down

0 comments on commit ae274ca

Please sign in to comment.