Skip to content

Commit

Permalink
add fly deploy and workflow step
Browse files Browse the repository at this point in the history
  • Loading branch information
devserkan committed Sep 16, 2024
1 parent bc24f69 commit 6183d4d
Show file tree
Hide file tree
Showing 7 changed files with 342 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
node_modules/
requests/

.env

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

# Editor directories and files
.vscode/
.idea/
*.swp
*.swo

# OS generated files
.DS_Store
Thumbs.db
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
6 changes: 5 additions & 1 deletion .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: '20'
# - uses: superfly/flyctl-actions/setup-flyctl@master
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Install dependencies for backend
run: npm ci
- name: Lint backend
Expand All @@ -38,3 +38,7 @@ jobs:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Deploy app
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=20.15.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" ]
28 changes: 28 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# fly.toml app configuration file generated for redux-anecdotes-ci on 2024-09-17T01:33:02+03:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'redux-anecdotes-ci'
primary_region = 'ams'

[build]

[env]
PORT = "3000"

[processes]
app = "node index.js"

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

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
Loading

0 comments on commit 6183d4d

Please sign in to comment.