Skip to content

Commit

Permalink
👷 Update to fly app v2
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarbar338 committed Nov 5, 2023
1 parent 2f7da0d commit feb49f7
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 39 deletions.
34 changes: 34 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# compiled output
/dist
/node_modules

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# OS
.DS_Store

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# Others
*.env
*lock*
9 changes: 6 additions & 3 deletions .github/workflows/deploy-to-fly.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
name: Fly Deploy

on: [push]
on:
push:
branches:
- main

env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

jobs:
deploy:
name: Deploy app
name: Deploy app to fly.io
runs-on: ubuntu-latest
if: contains(github.event.head_commit.message, '(deploy)')
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
ARG NODE_VERSION=18.18.1
FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime="NestJS"

# NestJS app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install -y build-essential pkg-config python-is-python3

# Install node modules
COPY --link package.json yarn.lock ./
RUN yarn install --frozen-lockfile --production=false

# Copy application code
COPY --link . .

# Build application
RUN yarn run build


# Final stage for app image
FROM base

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "yarn", "run", "start" ]
47 changes: 11 additions & 36 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,42 +1,17 @@
# fly.toml file generated for brawlhalla on 2022-07-08T09:31:28+03:00
# fly.toml app configuration file generated for brawlhalla on 2023-11-05T12:49:16+03:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "brawlhalla"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
primary_region = "cdg"

[build]
builder = "heroku/buildpacks:20"

[env]
PORT = "8080"

[experimental]
allowed_public_ports = []
auto_rollback = true

[[services]]
http_checks = []
internal_port = 8080
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80

[[services.ports]]
handlers = ["tls", "http"]
port = 443

[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"xml2js": "^0.6.2"
},
"devDependencies": {
"@flydotio/dockerfile": "^0.4.10",
"@nestjs/cli": "^10.2.1",
"@nestjs/schematics": "^10.0.3",
"@types/morgan": "^1.9.7",
Expand Down

0 comments on commit feb49f7

Please sign in to comment.