diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index aeb50f628..538f2a9c3 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -11,7 +11,9 @@ on: jobs: docker: runs-on: ubuntu-latest - + strategy: + matrix: + node-version: [20] steps: - name: Set up QEMU @@ -26,10 +28,22 @@ jobs: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@v3 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + + - run: npm i + working-directory: ${{ github.workspace }} + - - name: Build and push + name: Build & Push uses: docker/build-push-action@v5 with: + context: . push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} tags: ghcr.io/${{ github.repository_owner }}/ultralight:latest provenance: false diff --git a/Dockerfile b/Dockerfile index c70dd9913..cb7d1c396 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:20-alpine as BUILD_IMAGE +FROM node:20-alpine RUN apk update && apk add --no-cache bash g++ make git python3 && rm -rf /var/cache/apk/* RUN apk add --virtual .build-deps alpine-sdk jq @@ -7,16 +7,15 @@ RUN ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2 WORKDIR /ultralight -RUN jq -r '.workspaces |= .[0:2]' package.json > package.json -COPY package*.json ./ -COPY . . -RUN npm i --omit-dev +COPY node_modules node_modules +COPY packages/portalnetwork/dist packages/portalnetwork/dist +COPY packages/cli/dist packages/cli/dist +COPY packages/cli/package.json packages/cli +COPY packages/portalnetwork/package.json packages/portalnetwork -LABEL org.opencontainers.image.source=https://github.com/acolytec3/ultralight +# Sanity check +RUN node /ultralight/packages/cli/dist/index.js --help -FROM ubuntu:23.04 -RUN apt update && apt-get install nodejs musl-dev -y && ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 -COPY --from=BUILD_IMAGE ./ultralight ./ultralight ENV BINDADDRESS= ENV RPCPORT= ENV PK= diff --git a/Dockerfile.slim b/Dockerfile.slim deleted file mode 100644 index 2aad3f19a..000000000 --- a/Dockerfile.slim +++ /dev/null @@ -1,20 +0,0 @@ -FROM node:20-alpine - -RUN apk update && apk add --no-cache bash g++ make git python3 && rm -rf /var/cache/apk/* -RUN apk add --virtual .build-deps alpine-sdk jq - -RUN ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2 - -WORKDIR /ultralight - -COPY node_modules node_modules -COPY packages/portalnetwork/dist packages/portalnetwork/dist -COPY packages/cli/dist packages/cli/dist -COPY packages/cli/package.json packages/cli -COPY packages/portalnetwork/package.json packages/portalnetwork - -ENV BINDADDRESS= -ENV RPCPORT= -ENV PK= - -ENTRYPOINT node ultralight/packages/cli/dist/index.js --bindAddress=BINDADDRESS --rpcPort=RPCPORT \ No newline at end of file