diff --git a/.github/workflows/build-latest-v2.yml b/.github/workflows/build-latest-v2.yml index 58c0f0158..e401ccb72 100644 --- a/.github/workflows/build-latest-v2.yml +++ b/.github/workflows/build-latest-v2.yml @@ -214,9 +214,6 @@ jobs: runs-on: ubuntu-latest steps: - 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 @@ -226,8 +223,6 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - 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 diff --git a/.github/workflows/release-v2-docker.yml b/.github/workflows/release-v2-docker.yml index 452a6de75..e69bbd0f9 100644 --- a/.github/workflows/release-v2-docker.yml +++ b/.github/workflows/release-v2-docker.yml @@ -13,9 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - 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 @@ -25,8 +22,6 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - run: npm install - - run: npm run bundle - name: Get project versions run: | echo "server_version=$(cat package.json | jq ".version" | tr -d '"\r\n')" >> $GITHUB_OUTPUT diff --git a/Dockerfile b/Dockerfile index 770696307..2b0e70505 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,20 @@ +# build env +FROM node:18-slim AS build-env +WORKDIR /build +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build +RUN cd faucet-client && node ./build-client.js + +# final stage FROM node:18-slim WORKDIR /app RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates RUN update-ca-certificates -COPY dist ./dist -COPY static ./static -COPY faucet-config.example.yaml . +COPY --from=build-env /build/dist ./dist +COPY --from=build-env /build/static ./static +COPY --from=build-env /build/faucet-config.example.yaml . EXPOSE 8080 -ENTRYPOINT [ "node", "--no-deprecation", "dist/powfaucet.js" ] +ENTRYPOINT [ "node", "--no-deprecation", "dist/app.js" ]