nodejs
Some checks failed
build nodejs / images:java_${{ matrix.tag }} (20_pnpm) (push) Failing after 16s
build nodejs / images:java_${{ matrix.tag }} (20_yarn) (push) Failing after 15s
build java / images:java_${{ matrix.tag }} (8) (push) Successful in 1m20s
build nodejs / images:java_${{ matrix.tag }} (20) (push) Successful in 1m2s
build java / images:java_${{ matrix.tag }} (8_with_firefox) (push) Successful in 2m32s

This commit is contained in:
Lee 2023-11-29 22:57:18 +00:00
parent 2e56c4a377
commit a9d2757a00
8 changed files with 157 additions and 76 deletions

@ -1,63 +1,57 @@
name: Publish Docker Image name: build nodejs
on:
on: workflow_dispatch:
schedule: schedule:
- cron: "@weekly" - cron: "0 0 * * 1"
push: push:
branches: branches:
- "master" - master
paths:
jobs: - nodejs/**
docker: - .gitea/workflows/nodejs.yml
runs-on: ubuntu-22.04 jobs:
steps: push:
- name: Checkout name: "images:java_${{ matrix.tag }}"
uses: actions/checkout@v3 runs-on: ubuntu-22.04
strategy:
- name: Restore Docker Cache fail-fast: false
uses: actions/cache@v3 matrix:
id: docker-cache tag:
with: - 20
path: /usr/bin/docker - 20_pnpm
key: ${{ runner.os }}-docker - 20_yarn
steps:
- name: Install Docker (if not cached) - name: Checkout
if: steps.docker-cache.outputs.cache-hit != 'true' uses: actions/checkout@v3
run: |
wget -q -O /tmp/docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz \ - name: Restore Docker Cache
&& tar --extract --file /tmp/docker.tgz --directory /usr/bin --strip-components 1 --no-same-owner docker/docker \ uses: actions/cache@v3
&& rm -rf /tmp/* && id: docker-cache
echo "Done" with:
path: /usr/bin/docker
- name: Set up Docker Buildx key: ${{ runner.os }}-docker
uses: docker/setup-buildx-action@v2
- name: Install Docker (if not cached)
- name: Login to Repo if: steps.docker-cache.outputs.cache-hit != 'true'
uses: docker/login-action@v2 run: |
with: wget -q -O /tmp/docker.tgz https://download.docker.com/linux/static/stable/x86_64/docker-24.0.7.tgz \
username: ${{ secrets.REPO_USERNAME }} && tar --extract --file /tmp/docker.tgz --directory /usr/bin --strip-components 1 --no-same-owner docker/docker \
password: ${{ secrets.REPO_TOKEN }} && rm -rf /tmp/* &&
echo "Done"
- name: Build and Push (Latest NodeJS)
uses: docker/build-push-action@v4 - name: Set up Docker Buildx
with: uses: docker/setup-buildx-action@v2
push: true
context: ./gitea-runner - name: Login to Repo
file: .NodeLatestDockerfile uses: docker/login-action@v2
tags: fascinated/docker-images:node-latest with:
username: ${{ secrets.REPO_USERNAME }}
- name: Build and Push (Latest NodeJS - pnpm) password: ${{ secrets.REPO_TOKEN }}
uses: docker/build-push-action@v4
with: - uses: docker/build-push-action@v5
push: true with:
context: ./gitea-runner context: ./nodejs
file: .NodeWithPnpmLatestDockerfile file: ./nodejs/${{ matrix.tag }}/Dockerfile
tags: fascinated/docker-images:node-pnpm-latest push: true
tags: |
- name: Build and Push (Latest NodeJS - yarn) fascinated/docker-images:nodejs_${{ matrix.tag }}
uses: docker/build-push-action@v4
with:
push: true
context: ./gitea-runner
file: .NodeWithYarnLatestDockerfile
tags: fascinated/docker-images:node-yarn-latest

@ -1,6 +0,0 @@
FROM fascinated/docker-images:node-latest
# Install pnpm
RUN npm install -g pnpm
ENV PNPM_HOME=/usr/local/bin

@ -1,4 +0,0 @@
FROM fascinated/docker-images:node-latest
# Install yarn
RUN npm install -g yarn --force

@ -34,7 +34,7 @@ export INTERNAL_IP
cd /home/container || exit 1 cd /home/container || exit 1
# Print Java version # Print Java version
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0mjava -version\n" print "Container is running Java version: "
java -version java -version
# Convert all of the "{{VARIABLE}}" parts of the command into the expected shell # 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 # Display the command we're running in the output, and then execute it with the env
# from the container itself. # from the container itself.
printf "\033[1m\033[33mcontainer@pterodactyl~ \033[0m%s\n" "$PARSED" print "Executing command: $PARSED"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
eval ${PARSED} eval ${PARSED}

@ -1,5 +1,5 @@
# Latest official NodeJS image # Latest official NodeJS image
FROM node:current-alpine AS node FROM node:20-alpine3.17 AS node
FROM docker:latest FROM docker:latest

@ -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

@ -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

49
nodejs/entrypoint.sh Normal file

@ -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}