Skip to content

Commit

Permalink
Fly.io
Browse files Browse the repository at this point in the history
  • Loading branch information
Zu18 committed Jan 23, 2024
1 parent b8aef0b commit e7d30e2
Show file tree
Hide file tree
Showing 6 changed files with 438 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
.DS_Store
41 changes: 41 additions & 0 deletions .github/workflows/fly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Fly Deploy

on:

push:

branches:

main # or master, depending on your default branch


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@v3




uses: superfly/flyctl-actions/setup-flyctl@master




run: flyctl deploy --remote-only


env:

FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# syntax = docker/dockerfile:1

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

LABEL fly_launch_runtime="Node.js"

# Node.js 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 --no-install-recommends -y build-essential node-gyp pkg-config python-is-python3

# Install node modules
COPY --link package-lock.json package.json ./
RUN npm ci

# Copy application code
COPY --link . .


# 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 [ "npm", "run", "start" ]
22 changes: 22 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# fly.toml app configuration file generated for server-zukhra-paing-alex on 2024-01-23T12:06:10Z
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "server-zukhra-paing-alex"
primary_region = "lhr"

[build]

[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]

[[vm]]
cpu_kind = "shared"
cpus = 1
memory_mb = 1024
Loading

0 comments on commit e7d30e2

Please sign in to comment.