diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/nodejs.yml similarity index 53% rename from .gitea/workflows/publish.yaml rename to .gitea/workflows/nodejs.yml index 43f48af..121233b 100644 --- a/.gitea/workflows/publish.yaml +++ b/.gitea/workflows/nodejs.yml @@ -1,63 +1,57 @@ -name: Publish Docker Image - -on: - schedule: - - cron: "@weekly" - push: - branches: - - "master" - -jobs: - docker: - runs-on: ubuntu-22.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Restore Docker Cache - uses: actions/cache@v3 - id: docker-cache - with: - path: /usr/bin/docker - key: ${{ runner.os }}-docker - - - name: Install Docker (if not cached) - if: steps.docker-cache.outputs.cache-hit != 'true' - run: | - wget -q -O /tmp/docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz \ - && tar --extract --file /tmp/docker.tgz --directory /usr/bin --strip-components 1 --no-same-owner docker/docker \ - && rm -rf /tmp/* && - echo "Done" - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to Repo - uses: docker/login-action@v2 - with: - username: ${{ secrets.REPO_USERNAME }} - password: ${{ secrets.REPO_TOKEN }} - - - name: Build and Push (Latest NodeJS) - uses: docker/build-push-action@v4 - with: - push: true - context: ./gitea-runner - file: .NodeLatestDockerfile - tags: fascinated/docker-images:node-latest - - - name: Build and Push (Latest NodeJS - pnpm) - uses: docker/build-push-action@v4 - with: - push: true - context: ./gitea-runner - file: .NodeWithPnpmLatestDockerfile - tags: fascinated/docker-images:node-pnpm-latest - - - name: Build and Push (Latest NodeJS - yarn) - uses: docker/build-push-action@v4 - with: - push: true - context: ./gitea-runner - file: .NodeWithYarnLatestDockerfile - tags: fascinated/docker-images:node-yarn-latest +name: build nodejs +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 1" + push: + branches: + - master + paths: + - nodejs/** + - .gitea/workflows/nodejs.yml +jobs: + push: + name: "images:java_${{ matrix.tag }}" + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + tag: + - 20 + - 20_pnpm + - 20_yarn + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Restore Docker Cache + uses: actions/cache@v3 + id: docker-cache + with: + path: /usr/bin/docker + key: ${{ runner.os }}-docker + + - name: Install Docker (if not cached) + if: steps.docker-cache.outputs.cache-hit != 'true' + run: | + wget -q -O /tmp/docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz \ + && tar --extract --file /tmp/docker.tgz --directory /usr/bin --strip-components 1 --no-same-owner docker/docker \ + && rm -rf /tmp/* && + echo "Done" + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to Repo + uses: docker/login-action@v2 + with: + username: ${{ secrets.REPO_USERNAME }} + password: ${{ secrets.REPO_TOKEN }} + + - uses: docker/build-push-action@v5 + with: + context: ./nodejs + file: ./nodejs/${{ matrix.tag }}/Dockerfile + push: true + tags: | + fascinated/docker-images:nodejs_${{ matrix.tag }} diff --git a/NodeWithPnpmLatestDockerfile b/NodeWithPnpmLatestDockerfile deleted file mode 100644 index e1b7776..0000000 --- a/NodeWithPnpmLatestDockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM fascinated/docker-images:node-latest - -# Install pnpm -RUN npm install -g pnpm - -ENV PNPM_HOME=/usr/local/bin diff --git a/NodeWithYarnLatestDockerfile b/NodeWithYarnLatestDockerfile deleted file mode 100644 index 0b6f9aa..0000000 --- a/NodeWithYarnLatestDockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM fascinated/docker-images:node-latest - -# Install yarn -RUN npm install -g yarn --force \ No newline at end of file diff --git a/java/entrypoint.sh b/java/entrypoint.sh index 45aaebd..adb1e06 100644 --- a/java/entrypoint.sh +++ b/java/entrypoint.sh @@ -34,7 +34,7 @@ export INTERNAL_IP cd /home/container || exit 1 # Print Java version -printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0mjava -version\n" +print "Container is running Java version: " java -version # Convert all of the "{{VARIABLE}}" parts of the command into the expected shell @@ -44,6 +44,6 @@ PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat # Display the command we're running in the output, and then execute it with the env # from the container itself. -printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" +print "Executing command: $PARSED" # shellcheck disable=SC2086 eval ${PARSED} \ No newline at end of file diff --git a/NodeLatestDockerfile b/nodejs/20/Dockerfile similarity index 93% rename from NodeLatestDockerfile rename to nodejs/20/Dockerfile index 9ad32d0..513b984 100644 --- a/NodeLatestDockerfile +++ b/nodejs/20/Dockerfile @@ -1,5 +1,5 @@ # Latest official NodeJS image -FROM node:current-alpine AS node +FROM node:20-alpine3.17 AS node FROM docker:latest diff --git a/nodejs/20_with_pnpm/Dockerfile b/nodejs/20_with_pnpm/Dockerfile new file mode 100644 index 0000000..8adeec5 --- /dev/null +++ b/nodejs/20_with_pnpm/Dockerfile @@ -0,0 +1,25 @@ +# Latest official NodeJS image +FROM node:20-alpine3.17 AS node + +FROM docker:latest + +WORKDIR /home/container + +# Copy Node from the official docker image +COPY --from=node /usr/local/lib /usr/local/lib +COPY --from=node /usr/local/include /usr/local/include +COPY --from=node /usr/local/bin /usr/local/bin + +# Install the necessary dependencies for Node.js +RUN apk add --no-cache libstdc++ libgcc + +# Install other dependencies +RUN apk add --no-cache curl wget git bash + +# Print the version of NodeJS we're running +RUN node --version + +# Install pnpm +RUN npm install -g pnpm + +ENV PNPM_HOME=/usr/local/bin \ No newline at end of file diff --git a/nodejs/20_with_yarn/Dockerfile b/nodejs/20_with_yarn/Dockerfile new file mode 100644 index 0000000..c8ab817 --- /dev/null +++ b/nodejs/20_with_yarn/Dockerfile @@ -0,0 +1,23 @@ +# Latest official NodeJS image +FROM node:20-alpine3.17 AS node + +FROM docker:latest + +WORKDIR /home/container + +# Copy Node from the official docker image +COPY --from=node /usr/local/lib /usr/local/lib +COPY --from=node /usr/local/include /usr/local/include +COPY --from=node /usr/local/bin /usr/local/bin + +# Install the necessary dependencies for Node.js +RUN apk add --no-cache libstdc++ libgcc + +# Install other dependencies +RUN apk add --no-cache curl wget git bash + +# Print the version of NodeJS we're running +RUN node --version + +# Install yarn +RUN npm install -g yarn --force \ No newline at end of file diff --git a/nodejs/entrypoint.sh b/nodejs/entrypoint.sh new file mode 100644 index 0000000..87c34b8 --- /dev/null +++ b/nodejs/entrypoint.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# +# Copyright (c) 2021 Matthew Penner +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# Default the TZ environment variable to UTC. +TZ=${TZ:-UTC} +export TZ + +# Set environment variable that holds the Internal Docker IP +INTERNAL_IP=$(ip route get 1 | awk '{print $(NF-2);exit}') +export INTERNAL_IP + +# Switch to the container's working directory +cd /home/container || exit 1 + +# Print Java version +print "Container is running NodeJS version: " +node --version + +# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell +# variable format of "${VARIABLE}" before evaluating the string and automatically +# replacing the values. +PARSED=$(echo "${STARTUP}" | sed -e 's/{{/${/g' -e 's/}}/}/g' | eval echo "$(cat -)") + +# Display the command we're running in the output, and then execute it with the env +# from the container itself. +print "Executing command: $PARSED" +# shellcheck disable=SC2086 +eval ${PARSED} \ No newline at end of file