Commit Graph

39 Commits

Author SHA1 Message Date
Moritz Zwerger
1fcc0f7aa5 docker: cleanup some building (#10957)
* docker: cleanup some building

Somehow `npm prune --omit=dev` does not properly remove unneeded dependencies, this is workarounded by deleting the `node_modules` folder and the running install again.

It also removes some unneeded large files in the docker container.

* docker building: improve caching, don't download node_modules twice
2025-03-25 21:38:35 +00:00
LitoMore
1664b88ee6 add support for npm 11 (#10795) 2025-01-10 19:14:15 +00:00
chris48s
d5bc5cac35 un-pin buildx version (#10453)
* un-pin buildx version

* convert stage name to lowercase

https://docs.docker.com/reference/build-checks/stage-name-casing/

* use key=value syntax

https://docs.docker.com/reference/build-checks/legacy-key-value-format/

* use JSON CMD format

https://docs.docker.com/reference/build-checks/json-args-recommended/
2024-08-18 20:57:49 +00:00
chris48s
15599ca4f5 remove libraries we don't need in docker build (#10443) 2024-08-15 22:35:26 +00:00
chris48s
01de8910cd deploy on node 20 (#9799)
* deploy on node 20

* use appropriate npm versions for each node version
2023-12-30 19:03:34 +00:00
chris48s
d8480a66c4 update npm prune command (#9470) 2023-08-12 21:46:03 +00:00
chris48s
0ffa3669b3 deploy on node 18 (#9385)
* deploy on node 18, run tests on node 20

* run test-bug-run-badge on node 18

* you missed a spot

* ..and another
2023-08-10 18:40:17 +00:00
chris48s
f84ccb24ae upgrade to npm 9 (#9323) 2023-07-16 15:07:20 +01:00
rroesch1
174b1915c5 fix: Set uid/gid in docker image to 0 (#8908)
* UIDs/GIDs in the docker image are messed up due to strange UIDs/GIDs in tarballs from the npm registry
* This change overrides the UID/GID of all files in `/usr/src/app`

fixes: badges/shields#8906

Co-authored-by: chris48s <chris48s@users.noreply.github.com>
2023-02-20 19:22:14 +00:00
chris48s
2e627b0218 expose port 443 in Dockerfile (#8889) 2023-02-08 17:00:55 +00:00
chris48s
07bc0325ee simplify NPM strict checks (#7973)
* simplify engine-strict/strict-peer-deps checks

* disable engine-strict for node 12/14 package tests

* update docs

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-05-17 20:23:06 +00:00
chris48s
560d267844 add labels to Dockerfile (#7862)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2022-04-18 12:33:05 +01:00
chris48s
99bffd3a86 Send better user-agent values (and got config changes) (#7309)
* expose fetchLimitBytes/userAgent in got-config module

* export a function not a factory

* send better user-agent values

- add userAgentBase setting
- send short SHA in user agent on heroku
- set a version (tag or short SHA) in Dockefile and use
  it to report server version in UA for docker users

* add a comment explaining fileSize

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-11-25 17:11:49 +00:00
chris48s
313dc983f1 upgrade to node 16 (#7271) 2021-11-15 19:29:50 +00:00
dependabot[bot]
b8665000f2 chore(deps-dev): bump gatsby and gatsby-plugin-catch-links (#7232)
* chore(deps-dev): bump gatsby and gatsby-plugin-catch-links

Bumps [gatsby](https://github.com/gatsbyjs/gatsby) and [gatsby-plugin-catch-links](https://github.com/gatsbyjs/gatsby/tree/HEAD/packages/gatsby-plugin-catch-links). These dependencies needed to be updated together.

Updates `gatsby` from 3.14.5 to 4.1.0
- [Release notes](https://github.com/gatsbyjs/gatsby/releases)
- [Changelog](https://github.com/gatsbyjs/gatsby/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gatsbyjs/gatsby/compare/gatsby@3.14.5...gatsby@4.1.0)

Updates `gatsby-plugin-catch-links` from 3.14.0 to 4.1.0
- [Release notes](https://github.com/gatsbyjs/gatsby/releases)
- [Changelog](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-catch-links/CHANGELOG.md)
- [Commits](https://github.com/gatsbyjs/gatsby/commits/gatsby-plugin-catch-links@4.1.0/packages/gatsby-plugin-catch-links)

---
updated-dependencies:
- dependency-name: gatsby
  dependency-type: direct:development
  update-type: version-update:semver-major
- dependency-name: gatsby-plugin-catch-links
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* docker: include tools needed by node-gyp

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Caleb Cartwright <caleb.cartwright@outlook.com>
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-11-06 01:53:42 +00:00
Su Yang
22995e4e35 use multi-stage build to reduce size (#6938)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2021-08-25 17:19:18 +00:00
chris48s
92772de68e use the right version of NPM in docker build (#6941) 2021-08-24 22:06:09 +00:00
Pierre-Yves B
68fb0b7bab Run on node 14 in production, drop node 10 support for badge-maker and update test matrix (#6652) 2021-06-21 20:46:55 +01:00
chris48s
0bcd7eef15 Run on node 12 in production, update test matrix (#5436)
* upgrade node/npm versions in package.json

* delete config for zeit now
zeit now is no more, vercel have decomissioned the now v1 platform

* upgrade to node 12 for (docker) self-hosting users

* update docs

* update test matrix
run tests on node 12 and node 14

* link to nodejs version support docs in package comment
we'll continue to tun the package tests on node 10
while its still maintained and drop in the next
major release

* update depcheck

* remove npm-install job
2020-08-18 19:28:58 +01:00
chris48s
31ee02cfbe bump to node 10 for self-hosting users (#5058)
Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
2020-05-07 20:26:41 +00:00
chris48s
3ba05cb184 📦 version 3 (#4756)
* Validate input to BadgeFactory.create() (#3875)

* validate input to create()

* remove deprecated properties (#3881)

* remove BadgeFactory class (#3884)

* Template literal templates (#4459)

- Remove use of the doT template library and move to generating SVG output using javascript template literals.
- Drop SVGO and mostly manually implement the optimisations.
- Add a bunch more tests

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>

* drop raster support in package CLI (#4523)

* drop raster support in package CLI
* update docs

* rename gh-badges package to badge-maker

* rename gh-badges dir to badge-maker

* update relative imports and other refs to in parent dir

'gh-badges' --> 'badge-maker'

* update snyk service tests

This change is only tangentially related

We've used the shields repo as an example for these tests so
moving files around in our repo has a knock-on effect on them

* add missing type hints to dev style page

* write the changelog/migration guide for v3

* use extension in README CLI example

* update CLI help

whoops - missed this in #4523

* bump version

* update for self-hosting users

* README updates

* drop .format param from CLI, always output SVG

* Change text[] to label and message, Remove JSON output

- Change text[] to label and message
- Fix message only badge
- Remove JSON output format
- Update the docs

* update package-lock

* rename 'template' to 'style'

* handle invalid styles in coalesceBadge

* ensure makeBadge is passed a string for template in coalesceBadge()

issue #4925

* fix (logo/no label text/label color specified) case

issue #4926

* add example of (logo/no label text/label color specified) to style debug page

* update type defs

* padding fix for FTB style

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
2020-04-23 20:05:48 +01:00
Paul Melnikow
66c7f13e38 Drop gif + png, and redirect png to raster.shields.io (#3644)
1. Remove rasterization support from the server. This responsibility is delegated to a raster server which proxies the SVG badges and renders them.
2. When a raster server URL is configured, 301 redirect all .png badges to the identical URL on the raster server.
    `https://img.shields.io/npm/v/express.png?style=flat-square` ↪️`https://raster.shields.io/npm/v/express.png?style=flat-square`
3. For configured redirects, redirect to the canonical URL on the raster server.
    `https://img.shields.io/vso/build/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/2.png?style=flat-square`
    ↪️`https://img.shields.io/azure-devops/build/totodem/8cf3ec0e-d0c2-4fcd-8206-ad204f254a96/2.png?style=flat-square`
4. Redirect the "legacy badge old version" to the appropriate URL on the raster server.
5. When no raster server is configured (e.g. PRs), render an SVG containing **404 | raster badges not available** for all `.png` badges. (Note that the raster server can be self-hosted; however, this is deferred to a later PR.)
5. Drop support for jpg and gif which are very infrequently used (see #3112). Render an SVG containing **410 | jpg no longer available**.
7. ~~Remove raster dependencies.~~ Remove the raster cache (which is only used in the CLI, and therefore pointless).
8. Move the LRUCache code out of the npm package.
8. A wee bit of refactoring in `server.js`.

Ref #3112
Close #3631
2019-07-06 16:41:46 -04:00
Paul Melnikow
d3261be1db Docker: Don't installl Cypress (#3634)
Noticed this in the Docker Hub build log:
https://cloud.docker.com/u/shieldsio/repository/registry-1.docker.io/shieldsio/shields/builds/de14f15e-0f10-4842-9ad2-42b8558bc2ff

Ref #3558
2019-07-02 21:17:10 -04:00
Paul Melnikow
ace2a7a695 Tweak Docker initialization (#3173)
* Tweak Docker initialization

1. Set NODE_ENV=production in Docker.
2. When NODE_ENV is production, bind to all interfaces. This seems like a
   sensible default.
3. Exclude Dockerfile from container to improve layer cacheability when
   modifying the dockerfile.

Ref #3165

* Rm obsolete comment
2019-03-06 21:15:03 -06:00
Paul Melnikow
d2861b2438 Switch to npm ci (#3034) 2019-02-18 17:28:09 -06:00
Paul Melnikow
a8e27d139d Fix Docker build (#2815)
Close #2814
2019-01-20 15:01:07 -05:00
Paul Melnikow
fa5309400d PaaS, CI, and production-friendly config (#2626)
This implements the configuration mechanism I described in #2621. The heavy lifting is delegated to [node-config](https://github.com/lorenwest/node-config) with a minor assist from [dotenv](https://github.com/motdotla/dotenv).

`private/secret.json` has been replaced with environment variables and/or `config/local.yml`. See `doc/server-secrets.md`.
2019-01-06 10:42:09 -05:00
Paul Melnikow
a7efd88ceb Revert to standard CI image and remove lingering references to fonts (#2326)
Follow-on to #2311.
2018-11-18 09:08:23 -05:00
Paul Melnikow
51897b3c7e Precompute text width using a lookup table (#2311)
This simplifies and further optimizes text-width computation by computing the entire width table in advance, and serializing it in the style of QuickTextMeasurer (#1390). This entirely removes the need for PDFKit at runtime. This has the advantage of fixing #1305 – more generally: producing the same result everywhere – without having to deploy a copy of Verdana.

The lifting is delegated to these three libraries, which are housed in a monorepo: https://github.com/metabolize/anafanafo

I'd be happy to move it into the badges org if folks want to collaborate on maintaining them.

QuickTextMeasurer took kerning pairs into account, whereas this implementation does not. I was thinking kerning would be a necessary refinement, though this seems to work well enough.

I dropped in a binary-search package to traverse the data structure, in part to conserve space. This causes a moderate performance regression, though there is ample room for improving on that: https://github.com/badges/shields/pull/2311#issuecomment-439182704
2018-11-15 17:27:21 -05:00
chris48s
990a80de49 use FONT_PATH in Dockerfile (#2179) 2018-10-19 19:21:34 +01:00
Eric Lordahl
7c7c9f5f04 Ensure both docker CMDs are invoked (#1686) 2018-05-30 09:10:58 +01:00
Vladimir Starkov
a681fdaa87 Fix docker run (#1439)
* fix: update nodejs version to latest LTS, to fullfill check-node-version. close #1437

* docs: add docker run example without shields.env file, because there is no such file in a repo and container wont start

* fix: docker build project, clean npm and run production mode. close #1373
2018-01-15 15:19:28 -05:00
Vladimir Starkov
db39093fa7 fix: add missing git to apk installation script. close #1435 (#1436) 2018-01-11 16:55:33 -05:00
Christophe Bliard
cafb66bd93 Add fallback font and missing libs for .png generation
If Verdana.ttf can't be loaded, the font file pointed by the
FALLBACK_FONT_PATH environment variable will be loaded.

This fixes width computation errors that can occur with non-latin
characters when running with Docker.
2017-09-22 13:27:59 -04:00
Adriaan Groenenboom
15f24fbcce Improve Docker run (envsubst, Alpine, documented env file) (#870)
* Add template for secret.json

- Move to faster and lighter Alpine base image

* Update documentation

* Update documentation

* Fix Github token config for secret.json

* Extend env file for Docker runtime configuration

- Update documentation
- Add gh_token for GH personal access token to secret template

* Change http to https in infoSite

* Update .dockerignore

* Update .gitignore

* Update dockerignore

* Remove ENV directive from Dockerfile

- Environment is needed at runtime, not at buildtime

* Docker: contain secret.json in private/

- Incorporates fix from 7c8b0e3d

* Use localhost in example env

* Use baseUrl in GitHub redirect

* Move GH personal token retrieval up

- To remove duplicate Promise.then()

* Typo in shields.example.env
2017-05-07 11:13:02 -07:00
Thomas VIAL
e374eeab80 Fixed Dockerfile and improved doc regarding secret.json. 2016-08-18 13:28:37 +02:00
Olivier Louvignes
f273b78180 chore(docker): do not target a specific minor 2016-01-16 15:32:37 +01:00
Andy Shinn
5335c872a0 fix broken Dockerfile to use official node image instead 2015-09-21 09:52:18 -05:00
Alexander Thiemann
933d959f0c Dockerized the shields.io service 2014-09-28 13:43:29 +02:00