diff --git a/.gitea/workflows/alpine-dockerio.yaml b/.gitea/workflows/alpine-dockerio.yaml deleted file mode 100644 index c6d309b..0000000 --- a/.gitea/workflows/alpine-dockerio.yaml +++ /dev/null @@ -1,82 +0,0 @@ -name: Build and Push Alpine NodeJS Image to docker.io Registry -on: - push: - branches: - - master - -jobs: - build: - name: Build and push nodejs alpine based to docker.io - runs-on: ubuntu-latest - container: - image: ghcr.io/catthehacker/ubuntu:act-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - name: Login to docker.io Registry - uses: docker/login-action@v3 - with: - registry: docker.io - username: aprimediet - password: ${{ secrets.DOCKER_TOKEN }} - - name: Build and push 14.21.3 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.alpine - build-args: | - REGISTRY_URL=aprimediet - ALPINE_VERSION=3.14 - push: true - tags: | - aprimediet/nodejs:14.21.3-alpine - aprimediet/nodejs:14-alpine - - name: Build and push 16.20.2 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.alpine - build-args: | - REGISTRY_URL=aprimediet - ALPINE_VERSION=3.16 - push: true - tags: | - aprimediet/nodejs:16.20.2-alpine - aprimediet/nodejs:16-alpine - - name: Build and push 18.19.1 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.alpine - build-args: | - REGISTRY_URL=aprimediet - ALPINE_VERSION=3.18 - push: true - tags: | - aprimediet/nodejs:18.19.1-alpine - aprimediet/nodejs:18-alpine - - name: Build and push 20.15.1 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.alpine - build-args: | - REGISTRY_URL=aprimediet - ALPINE_VERSION=3.20 - push: true - tags: | - aprimediet/nodejs:20.15.1-alpine - aprimediet/nodejs:20-alpine - - name: Build and push 22.11.0 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.alpine - build-args: | - REGISTRY_URL=aprimediet - ALPINE_VERSION=3.21 - push: true - tags: | - aprimediet/nodejs:22.11.1-alpine - aprimediet/nodejs:22-alpine - aprimediet/nodejs:alpine diff --git a/.gitea/workflows/alpine-winter.yaml b/.gitea/workflows/alpine-winter.yaml deleted file mode 100644 index ed24373..0000000 --- a/.gitea/workflows/alpine-winter.yaml +++ /dev/null @@ -1,82 +0,0 @@ -name: Build and Push Alpine NodeJS Image to Winter Access Registry -on: - push: - branches: - - master - -jobs: - build: - name: Build and push nodejs alpine based to git.winteraccess.id - runs-on: ubuntu-latest - container: - image: ghcr.io/catthehacker/ubuntu:act-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - name: Login to Winter Access Git Registry - uses: docker/login-action@v3 - with: - registry: git.winteraccess.id - username: ${{ vars.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_TOKEN }} - - name: Build and push 14.21.3 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.alpine - build-args: | - REGISTRY_URL=git.winteraccess.id/docker - ALPINE_VERSION=3.14 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:14.21.3-alpine - git.winteraccess.id/${{ gitea.repository }}:14-alpine - - name: Build and push 16.20.2 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.alpine - build-args: | - REGISTRY_URL=git.winteraccess.id/docker - ALPINE_VERSION=3.16 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:16.20.2-alpine - git.winteraccess.id/${{ gitea.repository }}:16-alpine - - name: Build and push 18.19.1 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.alpine - build-args: | - REGISTRY_URL=git.winteraccess.id/docker - ALPINE_VERSION=3.18 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:18.19.1-alpine - git.winteraccess.id/${{ gitea.repository }}:18-alpine - - name: Build and push 20.15.1 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.alpine - build-args: | - REGISTRY_URL=git.winteraccess.id/docker - ALPINE_VERSION=3.20 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:20.15.1-alpine - git.winteraccess.id/${{ gitea.repository }}:20-alpine - - name: Build and push 22.11.1 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.alpine - build-args: | - REGISTRY_URL=git.winteraccess.id/docker - ALPINE_VERSION=3.21 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:22.11.1-alpine - git.winteraccess.id/${{ gitea.repository }}:22-alpine - git.winteraccess.id/${{ gitea.repository }}:alpine diff --git a/.gitea/workflows/ubi9-dockerio.yaml b/.gitea/workflows/ubi9-dockerio.yaml deleted file mode 100644 index df7e94d..0000000 --- a/.gitea/workflows/ubi9-dockerio.yaml +++ /dev/null @@ -1,159 +0,0 @@ -name: Build and Push UBI9 NodeJS Image to docker.io Registry -on: - push: - branches: - - master - -jobs: - build: - name: Build and push nodejs ubi9 based to docker.io - runs-on: ubuntu-latest - container: - image: ghcr.io/catthehacker/ubuntu:act-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - name: Login to docker.io Registry - uses: docker/login-action@v3 - with: - registry: docker.io - username: aprimediet - password: ${{ secrets.DOCKER_TOKEN }} - - name: Build and push 14.21.3 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9 - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=14.21.3 - push: true - tags: | - aprimediet/nodejs:14.21.3-ubi9 - aprimediet/nodejs:14-ubi9 - - name: Build and push 16.20.2 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9 - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=16.20.2 - push: true - tags: | - aprimediet/nodejs:16.20.2-ubi9 - aprimediet/nodejs:16-ubi9 - - name: Build and push 18.20.5 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9 - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=18.20.5 - push: true - tags: | - aprimediet/nodejs:18.20.5-ubi9 - aprimediet/nodejs:18-ubi9 - - name: Build and push 20.18.0 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9 - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=20.18.0 - push: true - tags: | - aprimediet/nodejs:20.18.0-ubi9 - aprimediet/nodejs:20-ubi9 - - name: Build and push 22.12.0 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9 - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=22.12.0 - push: true - tags: | - aprimediet/nodejs:22.12.0-ubi9 - aprimediet/nodejs:22-ubi9 - aprimediet/nodejs:ubi9 - build-micro: - name: Build and push nodejs ubi9-micro based to docker.io - runs-on: ubuntu-latest - needs: - - build - container: - image: ghcr.io/catthehacker/ubuntu:act-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - name: Login to docker.io Registry - uses: docker/login-action@v3 - with: - registry: docker.io - username: aprimediet - password: ${{ secrets.DOCKER_TOKEN }} - - name: Build and push 14.21.3 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9-micro - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=14.21.3 - push: true - tags: | - aprimediet/nodejs:14.21.3-ubi9-micro - aprimediet/nodejs:14-ubi9-micro - - name: Build and push 16.20.2 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9-micro - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=16.20.2 - push: true - tags: | - aprimediet/nodejs:16.20.2-ubi9-micro - aprimediet/nodejs:16-ubi9-micro - - name: Build and push 18.20.5 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9-micro - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=18.20.5 - push: true - tags: | - aprimediet/nodejs:18.20.5-ubi9-micro - aprimediet/nodejs:18-ubi9-micro - - name: Build and push 20.18.0 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9-micro - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=20.18.0 - push: true - tags: | - aprimediet/nodejs:20.18.0-ubi9-micro - aprimediet/nodejs:20-ubi9-micro - - name: Build and push 22.12.0 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9-micro - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=22.12.0 - push: true - tags: | - aprimediet/nodejs:22.12.0-ubi9-micro - aprimediet/nodejs:22-ubi9-micro - aprimediet/nodejs:ubi9-micro diff --git a/.gitea/workflows/ubi9-winter.yaml b/.gitea/workflows/ubi9-winter.yaml deleted file mode 100644 index 064f6ec..0000000 --- a/.gitea/workflows/ubi9-winter.yaml +++ /dev/null @@ -1,159 +0,0 @@ -name: Build and Push UBI9 NodeJS Image to git.winteraccess.id Registry -on: - push: - branches: - - master - -jobs: - build: - name: Build and push nodejs ubi9 based to git.winteraccess.id - runs-on: ubuntu-latest - container: - image: ghcr.io/catthehacker/ubuntu:act-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - name: Login to git.winteraccess.id Registry - uses: docker/login-action@v3 - with: - registry: git.winteraccess.id - username: ${{ vars.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_TOKEN }} - - name: Build and push 14.21.3 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9 - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=14.21.3 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:14.21.3-ubi9 - git.winteraccess.id/${{ gitea.repository }}:14-ubi9 - - name: Build and push 16.20.2 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9 - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=16.20.2 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:16.20.2-ubi9 - git.winteraccess.id/${{ gitea.repository }}:16-ubi9 - - name: Build and push 18.20.5 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9 - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=18.20.5 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:18.20.5-ubi9 - git.winteraccess.id/${{ gitea.repository }}:18-ubi9 - - name: Build and push 20.18.0 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9 - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=20.18.0 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:20.18.0-ubi9 - git.winteraccess.id/${{ gitea.repository }}:20-ubi9 - - name: Build and push 22.12.0 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9 - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=22.12.0 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:22.12.0-ubi9 - git.winteraccess.id/${{ gitea.repository }}:22-ubi9 - git.winteraccess.id/${{ gitea.repository }}:ubi9 - build-micro: - name: Build and push nodejs ubi9-micro based to git.winteraccess.id - runs-on: ubuntu-latest - needs: - - build - container: - image: ghcr.io/catthehacker/ubuntu:act-latest - steps: - - name: Check out repository code - uses: actions/checkout@v3 - - name: Login to git.winteraccess.id Registry - uses: docker/login-action@v3 - with: - registry: git.winteraccess.id - username: ${{ vars.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_TOKEN }} - - name: Build and push 14.21.3 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9-micro - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=14.21.3 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:14.21.3-ubi9-micro - git.winteraccess.id/${{ gitea.repository }}:14-ubi9-micro - - name: Build and push 16.20.2 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9-micro - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=16.20.2 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:16.20.2-ubi9-micro - git.winteraccess.id/${{ gitea.repository }}:16-ubi9-micro - - name: Build and push 18.20.5 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9-micro - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=18.20.5 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:18.20.5-ubi9-micro - git.winteraccess.id/${{ gitea.repository }}:18-ubi9-micro - - name: Build and push 20.18.0 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9-micro - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=20.18.0 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:20.18.0-ubi9-micro - git.winteraccess.id/${{ gitea.repository }}:20-ubi9-micro - - name: Build and push 22.12.0 - uses: docker/build-push-action@v5 - with: - context: . - file: Dockerfile.ubi9-micro - build-args: | - NVM_VERSION=0.40.1 - NODE_VERSION=22.12.0 - push: true - tags: | - git.winteraccess.id/${{ gitea.repository }}:22.12.0-ubi9-micro - git.winteraccess.id/${{ gitea.repository }}:22-ubi9-micro - git.winteraccess.id/${{ gitea.repository }}:ubi9-micro diff --git a/Dockerfile.alpine b/Dockerfile.alpine index f1a5b5b..06fd1a3 100644 --- a/Dockerfile.alpine +++ b/Dockerfile.alpine @@ -4,50 +4,60 @@ # 20.11.1 = 3.19 # 20.15.1 = 3.20 # 22.11.0 = 3.21 -ARG REGISTRY_URL=docker.io/aprimediet -ARG ALPINE_VERSION=3.21 +ARG OS_VERSION=3.21 -FROM ${REGISTRY_URL}/alpine:${ALPINE_VERSION} -LABEL maintainer=" aprimediet@gmail.com" +FROM quay.io/sindigilive/alpine:${OS_VERSION} AS builder USER root WORKDIR /tmp -# Set Cache Directory -ENV NODE_DIR=/usr/local/share/nodejs -ENV NPM_CACHE_DIR=${NODE_DIR}/.npm-cache -ENV YARN_CACHE_DIR=${NODE_DIR}/.yarn-cache +# Add nginx user and group and install required nvm installer +RUN /sbin/apk add --update --no-cache \ + nodejs nodejs-dev npm ; -RUN addgroup -g 10001 nodejs && \ - adduser -D -u 10001 -G nodejs -s /bin/sh -h /app nodejs +FROM scratch -# INSTALL WGET AND REQUIRED BUILD TOOLS -RUN --mount=type=cache,target=/var/cache/apk \ - apk update && apk upgrade && apk add \ - nodejs nodejs-dev npm +ARG NODE_VERSION=22.11.0 +ARG NODE_VER_SHORT=22 -# SET NPM GLOBAL CACHE -RUN npm -g config set cache ${NPM_CACHE_DIR} && \ - npm config set cache ${NPM_CACHE_DIR} -# INSTALL YARN -RUN --mount=type=cache,target=${NPM_CACHE_DIR} \ - npm i -g yarn +ENV NODE_VERSION=${NODE_VERSION} +ENV NODE_VER_SHORT=${NODE_VER_SHORT} +ENV APP_ROOT_DIR=/app +ENV APP_DIR=${APP_ROOT_DIR}/htdocs +ENV NPM_CACHE_DIR=${APP_ROOT_DIR}/.npm-cache +ENV YARN_CACHE_DIR=${APP_ROOT_DIR}/.yarn-cache -# CREATE YARN CACHE DIR -RUN mkdir -p ${YARN_CACHE_DIR} +LABEL maintainer="Muhamad Aditya Prima " +LABEL name="nginx" +LABEL version="${NODE_VERSION}" +LABEL distribution-scope="public" -# SET YARN CACHE DIR -RUN yarn config set cache-folder ${YARN_CACHE_DIR} +#labels for container catalog +LABEL summary="Nginx ${NODE_VERSION} on alpine based container image" +LABEL description="Provide nginx on alpine based container base image" +LABEL io.k8s.description="Very small alpine linux container image" +LABEL io.k8s.display-name="Nginx ${NODE_VERSION}" -# CLEAR CACHE -RUN apk del curl && \ - rm -rf /var/cache/apk/* && \ - npm cache clean --force && \ - npm -g cache clean --force +COPY --from=builder / / + +# Setup user and directories +RUN /bin/mkdir -p ${APP_DIR} ${NPM_CACHE_DIR} ${YARN_CACHE_DIR} ; \ + /usr/sbin/addgroup -g 10001 nodejs ; \ + /usr/sbin/adduser -D -u 10001 -G nodejs -s /sbin/nologin -h ${APP_ROOT_DIR} nodejs ; \ + /bin/chown -R nodejs:nodejs ${APP_ROOT_DIR} ; \ + /usr/sbin/addgroup -g 10001 nodejs ; \ + /usr/sbin/adduser -D -u 10001 -G nodejs -s /sbin/nologin -h ${APP_DIR} nodejs ; \ + /usr/bin/npm -g config set cache ${NPM_CACHE_DIR} ; \ + /usr/bin/npm config set cache ${NPM_CACHE_DIR} ; \ + /usr/bin/npm i -g yarn ; \ + /usr/local/bin/yarn config set cache-folder ${YARN_CACHE_DIR} ; \ + /bin/rm -rf /var/cache/apk/* ; \ + /usr/bin/npm cache clean --force ; \ + /usr/bin/npm -g cache clean --force ; USER nodejs -WORKDIR /app +WORKDIR ${APP_DIR} -CMD ["node"] \ No newline at end of file +CMD ["/usr/bin/node", "-v"] \ No newline at end of file