Skip to content

Commit

Permalink
restructures files for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Pond authored and Ryan Pond committed Feb 15, 2024
1 parent 98a1c24 commit 918ad82
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 1 deletion.
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.19.0
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 [ "node", "server.js" ]
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 agewise-late-feather-5705 on 2024-02-15T07:48:13-06:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'agewise-late-feather-5705'
primary_region = 'dfw'

[build]

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

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('dotenv').config({ path: 'My files/Linux files/environment.env' });
require('dotenv').config({ path: '~/environment.env' });
const mysql = require('mysql2/promise');
const pool = mysql.createPool({
host: process.env.DB_HOST,
Expand Down

0 comments on commit 918ad82

Please sign in to comment.