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
25 lines
592 B
Docker
25 lines
592 B
Docker
FROM node:8-alpine
|
|
|
|
RUN mkdir -p /usr/src/app
|
|
RUN mkdir /usr/src/app/private
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY package.json package-lock.json /usr/src/app/
|
|
# Without the gh-badges package.json and CLI script in place, `npm ci` will fail.
|
|
COPY gh-badges /usr/src/app/gh-badges/
|
|
|
|
# We need dev deps to build the front end. We don't need Cypress, though.
|
|
RUN NODE_ENV=development CYPRESS_INSTALL_BINARY=0 npm ci
|
|
|
|
COPY . /usr/src/app
|
|
RUN npm run build
|
|
RUN npm prune --production
|
|
RUN npm cache clean --force
|
|
|
|
# Run the server using production configs.
|
|
ENV NODE_ENV production
|
|
|
|
CMD node server
|
|
|
|
EXPOSE 80
|