Skip to content

Commit

Permalink
more fixes for new build format
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Dec 31, 2023
1 parent 1051f56 commit a4b2ade
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-latest-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:
run: |
mv res/run-faucet.* ./
chmod +x ./run-faucet.sh
tar cfz powfaucet-server-all.tar.gz dist static faucet-config.example.yaml run-faucet.sh
zip -r powfaucet-server-all.zip dist static faucet-config.example.yaml run-faucet.bat
tar cfz powfaucet-server-all.tar.gz bundle static faucet-config.example.yaml run-faucet.sh
zip -r powfaucet-server-all.zip bundle static faucet-config.example.yaml run-faucet.bat
# package static folder
- name: Package static folder
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/pow-faucet-server-linux
asset_path: ./bin/pow-faucet-server-linux
asset_name: powfaucet-server-linux
asset_content_type: application/octet-stream
env:
Expand All @@ -167,7 +167,7 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/pow-faucet-server-win.exe
asset_path: ./bin/pow-faucet-server-win.exe
asset_name: powfaucet-server-win.exe
asset_content_type: application/octet-stream
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
run: |
mv res/run-faucet.* ./
chmod +x ./run-faucet.sh
tar cfz powfaucet-server-all.tar.gz dist static faucet-config.example.yaml run-faucet.sh
zip -r powfaucet-server-all.zip dist static faucet-config.example.yaml run-faucet.bat
tar cfz powfaucet-server-all.tar.gz bundle static faucet-config.example.yaml run-faucet.sh
zip -r powfaucet-server-all.zip bundle static faucet-config.example.yaml run-faucet.bat
# package static folder
- name: Package static folder
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/pow-faucet-server-linux
asset_path: ./bin/pow-faucet-server-linux
asset_name: powfaucet-server-linux
asset_content_type: application/octet-stream
env:
Expand All @@ -104,7 +104,7 @@ jobs:
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/pow-faucet-server-win.exe
asset_path: ./bin/pow-faucet-server-win.exe
asset_name: powfaucet-server-win.exe
asset_content_type: application/octet-stream
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ jobs:
- name: Upload powfaucet.js artifact
uses: actions/upload-artifact@v3
with:
path: ./dist/powfaucet.js
path: ./bundle/powfaucet.cjs
name: powfaucet.js
- name: Upload linux binary artifact
uses: actions/upload-artifact@v3
with:
path: ./dist/pow-faucet-server-linux
path: ./bin/pow-faucet-server-linux
name: powfaucet-server-linux
- name: Upload windows binary artifact
uses: actions/upload-artifact@v3
with:
path: ./dist/pow-faucet-server-win.exe
path: ./bin/pow-faucet-server-win.exe
name: powfaucet-server-win.exe
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ FROM node:18-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates
RUN update-ca-certificates
COPY --from=build-server-env /build/dist ./dist
COPY --from=build-server-env /build/bundle ./bundle
COPY --from=build-client-env /build/static ./static
COPY ./faucet-config.example.yaml .
RUN cp ./static/index.html ./static/index.seo.html && chmod 777 ./static/index.seo.html

EXPOSE 8080
ENTRYPOINT [ "node", "--no-deprecation", "dist/powfaucet.js" ]
ENTRYPOINT [ "node", "--no-deprecation", "bundle/powfaucet.cjs" ]
2 changes: 1 addition & 1 deletion res/run-faucet.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@

node --no-deprecation .\dist\powfaucet.js
node --no-deprecation .\bundle\powfaucet.cjs
4 changes: 2 additions & 2 deletions res/run-faucet.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
cd $( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )

until node --no-deprecation ./dist/powfaucet.js; do
echo "powfaucet.js crashed with exit code $?. Respawning.." >&2
until node --no-deprecation ./bundle/powfaucet.cjs; do
echo "powfaucet.cjs crashed with exit code $?. Respawning.." >&2
sleep 1
done
10 changes: 7 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path, { dirname } from 'path'
import { fileURLToPath } from "url";
import webpack from "webpack";

let importUrl = fileURLToPath(import.meta.url);
const __dirname = dirname(importUrl);
Expand All @@ -12,8 +13,11 @@ export default {
},
output: {
filename: 'powfaucet.cjs',
chunkFilename: 'powfaucet-[name].cjs',
path: path.resolve(__dirname, 'bundle'),
libraryTarget: 'umd',
}
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
],
};

0 comments on commit a4b2ade

Please sign in to comment.