Skip to content

Instantly share code, notes, and snippets.

@fideloper
Created July 13, 2022 18:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fideloper/fe1964c1eac4cadece79645e4f24c755 to your computer and use it in GitHub Desktop.
Save fideloper/fe1964c1eac4cadece79645e4f24c755 to your computer and use it in GitHub Desktop.
# https://docs.docker.com/samples/library/node/
ARG NODE_VERSION=16
# Build container
FROM node:${NODE_VERSION}-alpine AS build
ARG DUMB_INIT_VERSION
WORKDIR /home/node
ADD . /home/node
RUN apk add git
RUN yarn install
RUN yarn build && yarn cache clean
# Runtime container
FROM node:${NODE_VERSION}-alpine
WORKDIR /home/node
COPY --from=build /home/node /home/node
EXPOSE 8080
CMD ["yarn", "run", "serve"]
# fly.toml file generated for fid-express on 2022-07-13T13:06:07-05:00
app = "fid-express"
kill_signal = "SIGINT"
kill_timeout = 5
processes = []
[env]
PORT=8080
[experimental]
allowed_public_ports = []
auto_rollback = true
[[services]]
http_checks = []
internal_port = 8080
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"
const express = require('express')
const app = express()
require('dotenv').config();
app.get('/admin', (req, res) => {
res.send('Hello Admin!')
})
app.listen(process.env.PORT || 3000)
{
"name": "fid-express",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"serve": "NODE_ENV=production node index.js",
"build": "echo \"building\""
},
"author": "",
"license": "ISC",
"dependencies": {
"dotenv": "^16.0.1",
"express": "^4.18.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment