-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker improvements #5946
Docker improvements #5946
Changes from 5 commits
27c7793
8aa81b1
bf3b6ce
7f31eac
b804890
5c3638d
7ae2748
6fb39ef
6760a69
0d24af7
e41f5e2
b4c3103
9b0c7bf
ecc57d6
5eba8a1
dbe6f4c
18f9097
cf75152
1894774
f7c3bae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.env | ||
icon_cache | ||
logs | ||
dist |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
TZ="UTC" | ||
ROBOCHIMP_DATABASE_URL="postgresql://postgres:postgres@localhost:5435/robochimp_integration_test?connection_limit=500&pool_timeout=0&schema=public" | ||
DATABASE_URL="postgresql://postgres:postgres@localhost:5435/osb_integration_test?connection_limit=500&pool_timeout=0&schema=public" | ||
CLIENT_ID=111398433321891634 | ||
BOT_TOKEN=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | ||
TEST=true | ||
TEST=true | ||
CI=true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
services: | ||
osb: | ||
db: | ||
image: postgres:16-alpine | ||
command: -c 'max_connections=1000' | ||
command: -c 'max_connections=1000' -c 'log_connections=on' -c 'log_disconnections=on' | ||
restart: always | ||
container_name: osb_database | ||
ports: | ||
- "5435:3001" | ||
- "5435:5435" | ||
environment: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
PGPORT: 3001 | ||
PGPORT: 5435 | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
|
||
app: | ||
build: | ||
context: . | ||
args: | ||
GIT_BRANCH: ${GIT_BRANCH} | ||
depends_on: | ||
- db | ||
environment: | ||
ROBOCHIMP_DATABASE_URL: postgresql://postgres:postgres@db:5435/robochimp_integration_test?connection_limit=500&pool_timeout=0&schema=public | ||
DATABASE_URL: postgresql://postgres:postgres@db:5435/osb_integration_test?connection_limit=500&pool_timeout=0&schema=public | ||
WAIT_HOSTS: db:5435 | ||
|
||
volumes: | ||
postgres_data: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM node:20.15.0-alpine AS base | ||
WORKDIR /usr/src/app | ||
ENV CI=true | ||
RUN apk add --no-cache dumb-init python3 g++ make git | ||
RUN corepack enable | ||
|
||
COPY yarn.lock package.json .yarnrc.yml ./ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing the |
||
COPY .yarn/ .yarn/ | ||
|
||
ENTRYPOINT ["dumb-init", "--"] | ||
|
||
|
||
FROM base AS dependencies | ||
RUN yarn install --immutable | ||
|
||
|
||
FROM base AS build-run | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
ENV NODE_ENV="development" | ||
ENV NODE_OPTIONS="--enable-source-maps --max_old_space_size=4096" | ||
|
||
COPY --from=dependencies /usr/src/app/node_modules ./node_modules | ||
COPY . . | ||
|
||
ENV CI=true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
RUN cp .env.test .env | ||
|
||
RUN yarn run build:esbuild | ||
|
||
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.9.0/wait /wait | ||
RUN chmod +x /wait | ||
|
||
CMD /wait && yarn prisma db push --schema='./prisma/robochimp.prisma' && yarn prisma db push --schema='./prisma/schema.prisma' && yarn vitest run --config vitest.integration.config.mts | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,8 @@ | |
"test:unit": "vitest run --coverage --config vitest.unit.config.mts", | ||
"test:watch": "vitest --config vitest.unit.config.mts --coverage", | ||
"test:integration": "tsx ./src/scripts/integration-tests.ts", | ||
"watch": "tsc -w -p src" | ||
"watch": "tsc -w -p src", | ||
"build:esbuild": "esbuild src/index.ts src/lib/workers/kill.worker.ts src/lib/workers/finish.worker.ts src/lib/workers/casket.worker.ts --bundle --outdir=dist --platform=node --loader:.node=file" | ||
}, | ||
"dependencies": { | ||
"@napi-rs/canvas": "^0.1.53", | ||
|
@@ -51,6 +52,7 @@ | |
"@types/node-fetch": "^2.6.1", | ||
"@vitest/coverage-v8": "^1.6.0", | ||
"concurrently": "^8.2.2", | ||
"esbuild": "0.21.5", | ||
"fast-glob": "^3.3.2", | ||
"prettier": "^3.3.2", | ||
"prisma": "^5.16.1", | ||
|
@@ -61,5 +63,8 @@ | |
"engines": { | ||
"node": "20.15.0" | ||
}, | ||
"packageManager": "[email protected]" | ||
"packageManager": "[email protected]", | ||
"resolutions": { | ||
"esbuild": "0.21.5" | ||
} | ||
} |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
COPY
command is used without specifying ownership, which might lead to files being owned by the root user. This can pose a security risk if the application is expected to run as a non-root user but has access to root-owned files. Consider using the--chown=node:node
option with theCOPY
command to explicitly set file ownership.