Skip to content

Commit

Permalink
fix: some docker changes
Browse files Browse the repository at this point in the history
  • Loading branch information
diced committed May 31, 2024
1 parent 62d4658 commit 26814e7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ COPY --from=builder /zipline/code.json ./code.json
RUN yarn cache clean --all
RUN rm -rf /tmp/* /root/*

CMD ["node", "--enable-source-maps", "build/server.js"]
CMD ["node", "--enable-source-maps", "build/server"]
6 changes: 4 additions & 2 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
postgres:
image: postgres:15
Expand All @@ -19,13 +18,16 @@ services:
build:
context: .
dockerfile: Dockerfile
# entrypoint: ['yarn', 'db:prototype'] ONLY USE THIS ONCE!
# UNCOMMENT THE BELOW LINE ON THE FIRST RUN!
# entrypoint: ['pnpm', 'db:prototype']
ports:
- '3000:3000'
env_file:
- .env
environment:
- DATABASE_URL=postgres://postgres:postgres@postgres/postgres
- CORE_SECRET=thissecretisverynotsecretbutshouldonlybeusedindevelopmentsoitsfineiguess
- CORE_HOSTNAME=0.0.0.0
depends_on:
- postgres
volumes:
Expand Down
7 changes: 4 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3'
services:
postgres:
image: postgres:15
Expand All @@ -18,15 +17,17 @@ services:
zipline:
image: ghcr.io/diced/zipline:v4
# ATTENTION !
# entrypoint: ['yarn', 'db:prototype']
# entrypoint: ['pnpm', 'db:prototype']
# Uncomment the above for the first run, then comment it out again after it runs once.
# The database is subject to change, this will reset to match the prisma schema.
# The database is subject to change, this will reset the current db to match the prisma schema.
ports:
- '3000:3000'
env_file:
- .env
environment:
- DATABASE_URL=postgres://postgres:postgres@postgres/postgres
- CORE_HOSTNAME=0.0.0.0
# add other needed variables like CORE_SECRET
depends_on:
- postgres
volumes:
Expand Down
9 changes: 7 additions & 2 deletions src/lib/config/read.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ export const rawConfig: any = {
discord: null,
};

export const PROP_TO_ENV: Record<string, string> = {
export const PROP_TO_ENV: Record<string, string | string[]> = {
'core.port': 'CORE_PORT',
'core.hostname': 'CORE_HOSTNAME',
'core.secret': 'CORE_SECRET',
'core.databaseUrl': 'CORE_DATABASE_URL',
'core.databaseUrl': ['CORE_DATABASE_URL', 'DATABASE_URL'],
'core.returnHttpsUrls': 'CORE_RETURN_HTTPS_URLS',
'core.defaultDomain': 'CORE_DEFAULT_DOMAIN',
'core.tempDirectory': 'CORE_TEMP_DIRECTORY',
Expand Down Expand Up @@ -345,7 +345,12 @@ export function readEnv() {

for (let i = 0; i !== envs.length; ++i) {
const env = envs[i];
if (Array.isArray(env.variable)) {
env.variable = env.variable.find((v) => process.env[v] !== undefined) || 'DATABASE_URL';
}

const value = process.env[env.variable];

if (value === undefined) continue;

if (env.variable === 'DATASOURCE_TYPE') {
Expand Down

0 comments on commit 26814e7

Please sign in to comment.