项目作者: simbo

项目描述 :
Docker images with node and yarn and some opinionated optimizations.
高级语言: Shell
项目地址: git://github.com/simbo/docker-node.git
创建时间: 2017-07-13T22:18:56Z
项目社区:https://github.com/simbo/docker-node

开源协议:MIT License

下载


docker-node

Docker images with node.js and some opinionated settings.

GitHub Workflow Status
Docker Pulls

These images are derivates of the official node images
with the following changes:

  • timezone set to “Europe/Berlin”
  • simple prompt with current path and docker image name
  • yarn self-update check disabled
  • yarn cache as persistent volume (/yarn-cache)
  • nano installed and set as default editor

Beside the same variations like the original node image, there is also a *-gyp
version available, which includes all requirements to use node-gyp:

  • simbo/node:<VERSION> (debian buster with common libs)
  • simbo/node:<VERSION>-slim (minimum debian buster with curl)
  • simbo/node:<VERSION>-gyp (slim with node-gyp requirements)
  • simbo/node:<VERSION>-alpine (alpine)
  1. docker pull simbo/node:<VERSION>
  2. docker pull simbo/node:<VERSION>-slim
  3. docker pull simbo/node:<VERSION>-gyp
  4. docker pull simbo/node:<VERSION>-alpine

It is not recommended to use images with the tag latest as they refer to the
latest build and not necessarily to the latest version.

See the tags list for all available
image versions.

Using the Yarn Cache Volume

With the docker command:

  1. docker run --rm -it -v yarn-cache:/yarn-cache simbo/node bash

With docker-compose:

  1. version: "3.9"
  2. volumes:
  3. yarn-cache:
  4. services:
  5. app:
  6. image: simbo/node
  7. volumes:
  8. - yarn-cache:/yarn-cache

Development

Local Builds for Testing

  1. # build default image
  2. docker build -f Dockerfile -t test-simbo/node .
  3. # build slim image
  4. docker build -f Dockerfile-slim -t test-simbo/node-slim .
  5. # build gyp image
  6. docker build -f Dockerfile-gyp -t test-simbo/node-gyp .
  7. # build alpine image
  8. docker build -f Dockerfile-alpine -t test-simbo/node-alpine .
  9. # run default image with login shell
  10. docker run --rm -it test-simbo/node bash
  11. # run slim image with login shell
  12. docker run --rm -it test-simbo/node-slim bash
  13. # run gyp image with login shell
  14. docker run --rm -it test-simbo/node-gyp bash
  15. # run alpine image with login shell
  16. docker run --rm -it test-simbo/node-alpine sh -l
  17. # remove images afterwars
  18. docker image rm test-simbo/node test-simbo/node-slim test-simbo/node-gyp test-simbo/node-alpine
  19. # optionally: clear everything docker from your system
  20. docker system prune -a

Releasing new Versions

Use the release script release-version for automatically updating dockerfiles
and triggering new image releases using GitHub Actions and Docker Hub.

Usage: ./release-version <SEMVER_VERSION>

Example: ./release-version 10.23.0

Example output:

  1. # ./release-version 10.23.0
  2. 📦 Publish new Versions for simbo/docker-node
  3. This script will update all dockerfiles in this repository to
  4. node.js v10.23.0
  5. Changes will be committed, tagged with 10.23.0 and pushed to GitHub.
  6. This push should trigger GitHub Actions, where images will be built and released to Docker Hub, where they will be tagged with 10, 10.23 and 10.23.0.
  7. Press [ENTER] to continue or anything else to cancel.
  8. [master c012125] node.js v10.23.0
  9. 4 files changed, 4 insertions(+), 4 deletions(-)
  10. Objekte aufzählen: 25, fertig.
  11. Zähle Objekte: 100% (25/25), fertig.
  12. Delta-Kompression verwendet bis zu 4 Threads.
  13. Komprimiere Objekte: 100% (19/19), fertig.
  14. Schreibe Objekte: 100% (19/19), 2.23 KiB | 1.12 MiB/s, fertig.
  15. Gesamt 19 (Delta 12), Wiederverwendet 0 (Delta 0), Pack wiederverwendet 0
  16. remote: Resolving deltas: 100% (12/12), completed with 6 local objects.
  17. To github.com:simbo/docker-node.git
  18. b498c44..c012125 master -> master
  19. * [new tag] 10.23.0 -> 10.23.0
  20. All done.
  21. See GitHub Actions for CI details: https://github.com/simbo/docker-node/actions
  22. See Docker Hub for released images: https://hub.docker.com/r/simbo/node/tags

License and Author

MIT © Simon Lepel