Skip to content

Commit 0a2c7a9

Browse files
jherrjacob-ebey
andauthored
Dockerizing (#35)
* Dockerizing * Adding demo data back * Update Dockerfile (#38) Co-authored-by: Jacob Ebey <[email protected]>
1 parent 69f6cba commit 0a2c7a9

File tree

5 files changed

+42
-148
lines changed

5 files changed

+42
-148
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,26 @@ jobs:
1414
- uses: actions/checkout@master
1515
with:
1616
fetch-depth: 0
17-
17+
1818
- name: Setup environment
1919
id: setups
2020
run: |-
2121
echo "::set-output name=yarn_cache::$(yarn cache dir)"
2222
echo "::set-output name=node_version::$(cat .nvmrc)"
23-
23+
2424
- name: Setup Node ${{ steps.setups.outputs.node_version }}
2525
uses: actions/setup-node@master
2626
with:
2727
node-version: ${{ steps.setups.outputs.node_version }}
28-
28+
2929
- name: Yarn cache
3030
uses: actions/cache@v1
3131
with:
3232
path: ${{ steps.setups.outputs.yarn_cache }}
3333
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-node-${{ steps.setups.outputs.node_version }}
34-
34+
3535
- run: yarn --frozen-lockfile
36-
36+
3737
- name: Create Release or Publish
3838
uses: changesets/action@master
3939
with:

dashboard-fe/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM node:12.8-alpine as test-target
2+
ENV NODE_ENV=test
3+
ENV PATH $PATH:/usr/src/app/node_modules/.bin
4+
WORKDIR /usr/src/app
5+
COPY package*.json ./
6+
RUN npm install
7+
COPY . .
8+
9+
# Build
10+
FROM test-target as build-target
11+
ENV NODE_ENV=production
12+
ENV PATH $PATH:/usr/src/app/node_modules/.bin
13+
WORKDIR /usr/src/app
14+
RUN npm run build
15+
RUN npm prune --production
16+
17+
# Archive
18+
FROM node:12.8-alpine as archive-target
19+
ENV NODE_ENV=production
20+
ENV PATH $PATH:/usr/src/app/node_modules/.bin
21+
WORKDIR /usr/src/app
22+
23+
# Include only the release build and production packages.
24+
COPY --from=build-target /usr/src/app/node_modules node_modules
25+
COPY --from=build-target /usr/src/app/.next .next
26+
27+
ENV DATA_DIR /data
28+
RUN mkdir -p /data
29+
30+
EXPOSE 3000
31+
CMD ["next", "start"]

dashboard-fe/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"scripts": {
66
"dev": "next dev -p 3000",
77
"build": "next build",
8-
"start": "next start"
9-
},
10-
"bin": {
11-
"mfdash": "./bin/mfdash.js"
8+
"start": "next start",
9+
"docker:build": "docker build . -t mf-dashboard",
10+
"docker:run": "docker run -p 3000:3000 -t mf-dashboard",
11+
"docker:demo": "docker run -p 3000:3000 --mount type=bind,source=\"$(pwd)\"/.fm-dashboard,target=/data -t mf-dashboard"
1212
},
1313
"contributors": [
1414
{

dashboard-fe/pages/api/db.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import Datastore from "nedb";
22
import path from "path";
3-
import fetch from "node-fetch";
43

5-
const dir = process.env.DATA_DIR || process.cwd();
4+
const dir = process.env.DATA_DIR || path.join(process.cwd(), "./.fm-dashboard");
65

76
const db = new Datastore({
8-
filename: path.join(dir, "./.fm-dashboard/apps.db"),
7+
filename: path.join(dir, "/apps.db"),
98
});
109
db.loadDatabase();
1110

dashboard-fe/scripts/convert-to-graph.js

Lines changed: 0 additions & 136 deletions
This file was deleted.

0 commit comments

Comments
 (0)