Switch to node:16-bullsys-slim images to reduce final image size (#144)

This commit is contained in:
Simon J
2023-03-06 18:39:40 +11:00
committed by GitHub
parent f86a78b338
commit cefdf5e2d5
11 changed files with 152154 additions and 8277 deletions

View File

@@ -11,4 +11,5 @@ RUN apt-get update && \
python3 \ python3 \
make \ make \
git \ git \
g++ g++ \
vim

6
.dockerignore Normal file
View File

@@ -0,0 +1,6 @@
.devcontainer
.github
.yarn/cache
.yarn/install-state.gz
build
node_modules

147529
.yarn/releases/yarn-1.22.19.cjs vendored Executable file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,3 @@
nodeLinker: node-modules nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-berry.cjs yarnPath: .yarn/releases/yarn-1.22.19.cjs

View File

@@ -1,4 +1,4 @@
FROM node:16-bullseye as build FROM node:16-bullseye-slim as build
WORKDIR /bonob WORKDIR /bonob
@@ -29,13 +29,24 @@ RUN apt-get update && \
g++ && \ g++ && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* && \ rm -rf /var/lib/apt/lists/* && \
yarn install --immutable && \ yarn config set network-timeout 600000 -g && \
yarn gitinfo && \ yarn install \
--prefer-offline \
--frozen-lockfile \
--non-interactive \
--production=false && \
yarn test --no-cache && \ yarn test --no-cache && \
yarn build yarn gitinfo && \
yarn build && \
rm -Rf node_modules && \
NODE_ENV=production yarn install \
--prefer-offline \
--pure-lockfile \
--non-interactive \
--production=true
FROM node:16-bullseye FROM node:16-bullseye-slim
LABEL maintainer=simojenki LABEL maintainer=simojenki
@@ -58,7 +69,9 @@ COPY src/Sonoswsdl-1.19.4-20190411.142401-3.wsdl ./src/Sonoswsdl-1.19.4-20190411
RUN apt-get update && \ RUN apt-get update && \
apt-get -y upgrade && \ apt-get -y upgrade && \
apt-get -y install --no-install-recommends libvips tzdata && \ apt-get -y install --no-install-recommends \
libvips \
tzdata && \
apt-get clean && \ apt-get clean && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*

View File

@@ -6,54 +6,56 @@
"author": "simojenki <simojenki@users.noreply.github.com>", "author": "simojenki <simojenki@users.noreply.github.com>",
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"dependencies": { "dependencies": {
"@svrooij/sonos": "^2.4.0", "@svrooij/sonos": "^2.5.0",
"@types/express": "^4.17.13", "@types/express": "^4.17.17",
"@types/fs-extra": "^9.0.13", "@types/fs-extra": "^11.0.1",
"@types/jsonwebtoken": "^8.5.5", "@types/jsonwebtoken": "^9.0.1",
"@types/jws": "^3.2.4", "@types/jws": "^3.2.5",
"@types/morgan": "^1.9.3", "@types/morgan": "^1.9.4",
"@types/node": "^16.7.13", "@types/node": "^16.11.7",
"@types/randomstring": "^1.1.8", "@types/randomstring": "^1.1.8",
"@types/sharp": "^0.28.6", "@types/sharp": "^0.31.1",
"@types/underscore": "^1.11.3", "@types/underscore": "^1.11.4",
"@types/uuid": "^8.3.1", "@types/uuid": "^9.0.1",
"axios": "^0.21.4", "@types/xmldom": "0.1.31",
"dayjs": "^1.10.6", "axios": "^1.3.4",
"eta": "^2.0.0", "dayjs": "^1.11.7",
"express": "^4.17.3", "eta": "^2.0.1",
"fp-ts": "^2.11.1", "express": "^4.18.2",
"fs-extra": "^10.0.0", "fp-ts": "^2.13.1",
"fs-extra": "^11.1.0",
"jsonwebtoken": "^9.0.0", "jsonwebtoken": "^9.0.0",
"jws": "^4.0.0", "jws": "^4.0.0",
"libxmljs2": "^0.28.0", "libxmljs2": "^0.31.0",
"morgan": "^1.10.0", "morgan": "^1.10.0",
"node-html-parser": "^4.1.4", "node-html-parser": "^6.1.5",
"randomstring": "^1.2.1", "randomstring": "^1.2.3",
"sharp": "^0.30.5", "sharp": "^0.31.3",
"soap": "^0.42.0", "soap": "^1.0.0",
"ts-md5": "^1.2.9", "ts-md5": "^1.3.1",
"typescript": "^4.4.2", "typescript": "^4.9.5",
"underscore": "^1.13.1", "underscore": "^1.13.6",
"urn-lib": "^2.0.0", "urn-lib": "^2.0.0",
"uuid": "^8.3.2", "uuid": "^9.0.0",
"winston": "^3.3.3" "winston": "^3.8.2",
"xmldom-ts": "^0.3.1"
}, },
"devDependencies": { "devDependencies": {
"@types/chai": "^4.2.21", "@types/chai": "^4.3.4",
"@types/jest": "^27.0.1", "@types/jest": "^29.4.0",
"@types/mocha": "^9.0.0", "@types/mocha": "^10.0.1",
"@types/supertest": "^2.0.11", "@types/supertest": "^2.0.12",
"@types/tmp": "^0.2.1", "@types/tmp": "^0.2.3",
"chai": "^4.3.4", "chai": "^4.3.7",
"get-port": "^5.1.1", "get-port": "^6.1.2",
"image-js": "^0.33.0", "image-js": "^0.35.3",
"jest": "^27.1.0", "jest": "^29.4.3",
"nodemon": "^2.0.12", "nodemon": "^2.0.21",
"supertest": "^6.1.6", "supertest": "^6.3.3",
"tmp": "^0.2.1", "tmp": "^0.2.1",
"ts-jest": "^27.0.5", "ts-jest": "^29.0.5",
"ts-mockito": "^2.6.1", "ts-mockito": "^2.6.1",
"ts-node": "^10.2.1", "ts-node": "^10.9.1",
"xmldom-ts": "^0.3.1", "xmldom-ts": "^0.3.1",
"xpath-ts": "^1.3.13" "xpath-ts": "^1.3.13"
}, },
@@ -65,5 +67,6 @@
"register-dev": "ts-node ./src/register.ts http://$(hostname):4534", "register-dev": "ts-node ./src/register.ts http://$(hostname):4534",
"test": "jest", "test": "jest",
"gitinfo": "git describe --tags > .gitinfo" "gitinfo": "git describe --tags > .gitinfo"
} },
"packageManager": "yarn@1.22.19"
} }

View File

@@ -2,7 +2,7 @@ import { option as O, taskEither as TE } from "fp-ts";
import * as A from "fp-ts/Array"; import * as A from "fp-ts/Array";
import { ordString } from "fp-ts/lib/Ord"; import { ordString } from "fp-ts/lib/Ord";
import { pipe } from "fp-ts/lib/function"; import { pipe } from "fp-ts/lib/function";
import { Md5 } from "ts-md5/dist/md5"; import { Md5 } from "ts-md5";
import { import {
Credentials, Credentials,
MusicService, MusicService,

View File

@@ -120,7 +120,7 @@ describe("service config", () => {
describe(STRINGS_ROUTE, () => { describe(STRINGS_ROUTE, () => {
it("should return xml for the strings", async () => { it("should return xml for the strings", async () => {
const xml = await fetchStringsXml(); const xml: Document = await fetchStringsXml();
const sonosString = (id: string, lang: string) => const sonosString = (id: string, lang: string) =>
xpath.select( xpath.select(

View File

@@ -1,4 +1,4 @@
import { Md5 } from "ts-md5/dist/md5"; import { Md5 } from "ts-md5";
import { v4 as uuid } from "uuid"; import { v4 as uuid } from "uuid";
import tmp from "tmp"; import tmp from "tmp";
import fse from "fs-extra"; import fse from "fs-extra";

12146
yarn.lock

File diff suppressed because it is too large Load Diff