Skip to content

Commit

Permalink
docs: update DockerFile and add a docker-compose example (#1476)
Browse files Browse the repository at this point in the history
Co-authored-by: Matej Voboril <[email protected]>
  • Loading branch information
SlayerOrnstein and TobiTenno authored May 15, 2024
1 parent 2b336cd commit cd182e3
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 6 deletions.
64 changes: 64 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc spec coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

# PM2 Config
warframe-status.json

# Temp file storage
tmp/

#nodemon dev config
.nodemon
nodemon.json
.env

# JetBrains files
.idea/
.run/

# flatcache for the items
.items
.wfinfo
.twitch
.drops
.rivens
.hy-info

# generated files by precommit hook
.jshintrc
.jshintignore
16 changes: 15 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,18 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: false
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
semantic-release:
runs-on: ubuntu-latest
needs: [ test ]
outputs:
new_version: ${{ steps.semantic.outputs.new_release_version }}
release: ${{ steps.release.outputs.release }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -42,6 +45,7 @@ jobs:
node-version: '14'
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
Expand Down Expand Up @@ -95,3 +99,29 @@ jobs:
- name: Deploy - Start Process
if: ${{ steps.release.outputs.release == 'yes' }}
run: ssh prod 'source ~/.zshrc && cd ~/warframe-status && pm2 start warframe-status.json'
registry-release:
needs: semantic-release
if: ${{ needs.semantic-release.outputs.release == 'yes' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
ghcr.io/WFCD/warframe-status:latest
ghcr.io/WFCD/warframe-status:${{ needs.semantic-release.outputs.new_version }}
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
FROM node:16 as build-stage
FROM node:lts-alpine as build

WORKDIR /app
COPY package*.json /app/
COPY package*.json ./
RUN npm install

FROM node:lts-alpine as production

WORKDIR /app

COPY ./ /app/
EXPOSE 3001
COPY --from=build node_modules/ node_modules/

ENTRYPOINT npm run start
ENV HOSTNAME=0.0.0.0
ENV PORT=3001

EXPOSE 3001
ENTRYPOINT npm start
15 changes: 15 additions & 0 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
warframestatus:
image: warframestatus:latest
build: . # you can remove this if you plan to use your own image
# environment:
# - TWITTER_KEY=
# - TWITTER_SECRET=
# - TWITTER_BEARER_TOKEN=
# - WFINFO_FILTERED_ITEMS=
# - WFINFO_PRICES=
# - SENTRY_DSN=
# - BUILD=
# - LOG_LEVEL=
expose:
- 8080:3001 # Host port can be whatever you need it to be

0 comments on commit cd182e3

Please sign in to comment.