Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ references:
jobs:
build_package:
docker:
- image: cimg/node:20.1.0
- image: cimg/node:22.23.4
working_directory: ~/workdir
steps:
- attach_workspace:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:

publish_packages:
docker:
- image: cimg/node:20.1.0
- image: cimg/node:22.23.4
working_directory: ~/workdir
steps:
- attach_workspace:
Expand Down
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist
api-v3
src/api/client
.git
.codacy
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ temp/
# MacOS store files
.DS_Store


#Ignore vscode AI rules
.github/instructions/codacy.instructions.md

#JetBrains
.idea
30 changes: 19 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
FROM node:22.12-alpine AS builder
FROM node:22.23.4-trixie-slim AS builder

# Must be entire project because `prepare` script is run during `npm install` and requires all files.
COPY src/github /app
COPY tsconfig.json /tsconfig.json
# The API client under src/api/client is generated at build time (gitignored) and needs curl.
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl && rm -rf /var/lib/apt/lists/*

Check warning on line 4 in Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Dockerfile#L4

Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check warning on line 4 in Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Dockerfile#L4

The package cache was not deleted after running 'apt-get update', which increases the size of the image.
Comment thread
manufacturist marked this conversation as resolved.

WORKDIR /app

RUN --mount=type=cache,target=/root/.npm npm install
COPY . .

FROM node:22.12-alpine AS release
RUN --mount=type=cache,target=/root/.npm npm install && npm run update-api && npm run build
Comment thread
manufacturist marked this conversation as resolved.

COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json
# Debian (glibc) rather than Alpine, because the Python and Java runtimes the runner
# downloads for tools like Lizard and PMD are glibc builds.
FROM node:22.23.4-trixie-slim AS release

ENV NODE_ENV=production

# Local analysis discovers the repository's files through git, and unpacks some tool archives with unzip.
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git unzip && rm -rf /var/lib/apt/lists/*

Check warning on line 19 in Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Dockerfile#L19

Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`

Check warning on line 19 in Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

Dockerfile#L19

The package cache was not deleted after running 'apt-get update', which increases the size of the image.
Comment thread
manufacturist marked this conversation as resolved.

WORKDIR /app

RUN npm ci --ignore-scripts --omit-dev
COPY --from=builder /app/dist /app/dist
COPY --from=builder /app/package.json /app/package.json
COPY --from=builder /app/package-lock.json /app/package-lock.json

RUN npm ci --ignore-scripts --omit=dev

USER node

ENTRYPOINT ["node", "dist/index.js"]
ENTRYPOINT ["node", "dist/index.js"]