diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ad14803 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git +.github +README.md diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..d45c295 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,38 @@ +name: release + +on: + schedule: + - cron: 0 0 1 * * + push: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_REGISTRY_USER }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} + + - name: Build and push multi-arch image + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: | + linux/amd64 + tags: docker.io/${{ secrets.DOCKER_REGISTRY_USER }}/base-node:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8e6ea3a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM docker.io/rusian/hyperbola:latest + +ENV NVM_DIR=/root/.nvm +ENV NODE_VERSION=lts/* + +RUN pacman -Syu --noconfirm --noprogressbar \ + && pacman -S --noconfirm --noprogressbar \ + base-devel \ + doas \ + curl \ + ca-certificates \ + git \ + rsync \ + wget \ + bash \ + && pacman -Scc --noconfirm \ + && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash \ + && . "$NVM_DIR/nvm.sh" \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default \ + && npm install -g npm \ + && cp "$NVM_DIR/versions/node/$(ls $NVM_DIR/versions/node)/bin/node" /usr/local/bin/node \ + && cp "$NVM_DIR/versions/node/$(ls $NVM_DIR/versions/node)/bin/npm" /usr/local/bin/npm \ + && cp "$NVM_DIR/versions/node/$(ls $NVM_DIR/versions/node)/bin/npx" /usr/local/bin/npx \ + && useradd -m builder \ + && echo "permit nopass builder as root" > /etc/doas.conf \ + && chmod 0400 /etc/doas.conf \ + && rm -rf "$NVM_DIR/.cache" /tmp/* + +USER builder +WORKDIR /home/builder +ENV HOME=/home/builder + +CMD ["/bin/bash"] diff --git a/README.md b/README.md index 2063651..56aa4af 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Una imagen Docker base con **Node.js LTS instalado vía NVM**, ideal para proyec ## 📦 Características -- Basado en `ubuntu:22.04` +- Basado en `hyperbola:v0.4.4` - Node.js LTS instalado con `nvm` - Incluye `npm` y `npx` - Node.js accesible globalmente (`node`, `npm`, `npx` en `/usr/bin/`)