Skip to content

Commit

Permalink
fix for binary builds
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Jun 19, 2023
1 parent 5d82270 commit 34148ad
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 22 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.git
dist
node_modules
static/index.seo.html
faucet-config.json
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/build-latest-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,22 @@ jobs:
needs: [run_tests]
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18.15.0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: pk910/powfaucet:v2-latest
- run: npm install
- run: npm run bundle
- name: Build v2-latest docker image
run: docker build . --file Dockerfile --tag pk910/powfaucet:v2-latest
- name: Push v2-latest docker image
run: docker push pk910/powfaucet:v2-latest
12 changes: 5 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM nikolaik/python-nodejs:python3.10-nodejs18-slim
FROM node:18-slim
WORKDIR /app
COPY . /app
RUN npm install
RUN npm run build

COPY . .
COPY dist ./dist
COPY static ./static
COPY faucet-config.example.yaml .

EXPOSE 8080
ENTRYPOINT [ "node", "dist/app.js" ]
ENTRYPOINT [ "node", "dist/powfaucet.js" ]
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.0.0",
"description": "PoW Faucet Server",
"main": "dist/app.js",
"bin": "dist/app.js",
"bin": "dist/powfaucet.js",
"scripts": {
"build": "tsc",
"start": "tsc && node dist/app.js",
Expand Down
4 changes: 3 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from "path";
import { isMainThread, workerData } from "node:worker_threads";
import { loadFaucetConfig } from "./config/FaucetConfig";
import { loadFaucetConfig, setAppBasePath } from "./config/FaucetConfig";
import { FaucetWorkers } from "./common/FaucetWorker";
import { EthWalletManager } from "./eth/EthWalletManager";
import { FaucetHttpServer } from "./webserv/FaucetHttpServer";
Expand All @@ -16,6 +17,7 @@ import { SessionManager } from "./session/SessionManager";
FaucetWorkers.loadWorkerClass();
}
else {
setAppBasePath(path.join(__dirname, ".."))
loadFaucetConfig()
ServiceManager.GetService(FaucetProcess).initialize();
ServiceManager.GetService(FaucetWorkers).initialize(__filename);
Expand Down
4 changes: 4 additions & 0 deletions src/config/FaucetConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ else

export let faucetConfig: IConfigSchemaV2 = null;

export function setAppBasePath(basePath: string) {
internalBasePath = basePath;
}

export function loadFaucetConfig(loadDefaultsOnly?: boolean) {
let config: IConfigSchemaV2;
let configFile = faucetConfigFile;
Expand Down

0 comments on commit 34148ad

Please sign in to comment.