Skip to content

Commit

Permalink
Switch to a dockerfile deploy
Browse files Browse the repository at this point in the history
Tweak

Dockerfile tweaks
  • Loading branch information
bcomnes committed Sep 28, 2022
1 parent dd11822 commit 99382f8
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 3 deletions.
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.md
.env*
.git
.idea
.config
.npm
.github
.DS_Store
.gitignore
.scannerwork
.editorconfig
certs
LICENSE
nodemon.json
node_modules
npm-debug.log
32 changes: 32 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

FROM node:18-alpine

LABEL maintainer="HifiWifi LLC"

# Set the working directory
WORKDIR /usr/src/app

RUN apk add --no-cache python3

# Copy source code
COPY package*.json ./

# Copy the rest of your app's source code from your host to your image filesystem.
COPY . .

# Running npm install
# RUN npm install --omit=dev
RUN npm install

# Create a user group 'nodegroup', create a user 'nodeuser' under 'nodegroup' and chown all the files to the app user.
RUN addgroup -S nodegroup && \
adduser -S -D -h /usr/src/app nodeuser nodegroup && \
chown -R nodeuser:nodegroup /usr/src

# Switch to 'nodeuser'
USER nodeuser

# Open the mapped port
EXPOSE 3000

CMD [ "./node_modules/.bin/fastify", "start", "app.js" ]
2 changes: 1 addition & 1 deletion fly.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ kill_timeout = 5
processes = []

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

[build.args]
ENV = 'production'
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@
"gh-release": "^6.0.0",
"npm-run-all2": "^6.0.0",
"snazzy": "^9.0.0",
"sodium-native": "^3.2.1",
"standard": "^17.0.0",
"tap": "^16.0.0"
"tap": "^16.0.0",
"rimraf": "^3.0.2",
"sodium-native": "^3.2.1",
"mkdirp": "^1.0.4"
},
"engines": {
"node": "^18.0.0 || ^17.0.0",
Expand Down

0 comments on commit 99382f8

Please sign in to comment.