Skip to content

Commit

Permalink
Only install needed deps on docker image
Browse files Browse the repository at this point in the history
Signed-off-by: m4rc3l05 <15786310+M4RC3L05@users.noreply.github.com>
  • Loading branch information
M4RC3L05 committed Jan 11, 2025
1 parent a7f6dbe commit 2fbc5d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ WORKDIR /app

COPY --chown=deno:deno . .

RUN deno install --node-modules-dir --entrypoint src/apps/api/main.ts
RUN deno install --node-modules-dir --entrypoint src/apps/web/main.ts
RUN deno install --unstable-npm-lazy-caching --entrypoint src/apps/api/main.ts
RUN deno install --unstable-npm-lazy-caching --entrypoint src/apps/web/main.ts
RUN deno eval "import '@db/sqlite'"

RUN BUILD_DRY_RUN=true DATABASE_PATH=":memory:" timeout 2s deno task api || true
RUN BUILD_DRY_RUN=true DATABASE_PATH=":memory:" timeout 2s deno task web || true
RUN BUILD_DRY_RUN=true DATABASE_PATH=":memory:" timeout 2s deno run -A --cached-only --unstable-npm-lazy-caching src/apps/api/main.ts || true
RUN BUILD_DRY_RUN=true DATABASE_PATH=":memory:" timeout 2s deno run -A --cached-only --unstable-npm-lazy-caching src/apps/web/main.ts || true

RUN ls -la ./node_modules

RUN mkdir /app/data

Expand Down
6 changes: 3 additions & 3 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"tasks": {
"api": {
"description": "Run api app",
"command": "deno run -A --cached-only src/apps/api/main.ts"
"command": "deno run -A --cached-only --unstable-npm-lazy-caching src/apps/api/main.ts"
},
"web": {
"description": "Run web app",
"command": "deno run -A --cached-only src/apps/web/main.ts"
"command": "deno run -A --cached-only --unstable-npm-lazy-caching src/apps/web/main.ts"
},
"dev:pretty-logs": {
"description": "Interact with pino-pretty",
Expand Down Expand Up @@ -70,7 +70,7 @@
"@std/log": "jsr:@std/log@0.224.13",
"@std/tar": "jsr:@std/tar@0.1.4",
"@std/testing": "jsr:@std/testing@1.0.9",
"@std/text": "jsr:@std/text@^1.0.10",
"@std/text": "jsr:@std/text@1.0.10",
"@vinejs/vine": "npm:@vinejs/vine@3.0.0",
"config": "npm:config@3.3.12",
"dbmate": "npm:dbmate@2.24.2",
Expand Down
4 changes: 2 additions & 2 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2fbc5d9

Please sign in to comment.