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,15 +1,25 @@
name: Publish Docker Image
name: build nodejs
on:
workflow_dispatch:
schedule:
- cron: "@weekly"
- cron: "0 0 * * 1"
push:
branches:
- "master"
- master
paths:
- nodejs/**
- .gitea/workflows/nodejs.yml
jobs:
docker:
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
@ -38,26 +48,10 @@ jobs:
username: ${{ secrets.REPO_USERNAME }}
password: ${{ secrets.REPO_TOKEN }}
- name: Build and Push (Latest NodeJS)
uses: docker/build-push-action@v4
- uses: docker/build-push-action@v5
with:
context: ./nodejs
file: ./nodejs/${{ matrix.tag }}/Dockerfile
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
tags: |
fascinated/docker-images:nodejs_${{ matrix.tag }}

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

@ -1,5 +1,5 @@
# Latest official NodeJS image
FROM node:current-alpine AS node
FROM node:20-alpine3.17 AS node
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}