Skip to content

Commit

Permalink
Bug/docker env (#3)
Browse files Browse the repository at this point in the history
* chore(docker): docker bug env

* fix(docker_env): dockerfile.development read wrong env file
  • Loading branch information
infinitedim authored Aug 17, 2024
1 parent 1da3283 commit 623d098
Show file tree
Hide file tree
Showing 7 changed files with 294 additions and 90 deletions.
2 changes: 2 additions & 0 deletions apps/backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
POSTGRES_USER="example_user"
POSTGRES_PASSWORD="example_password"

POSTGRES_DB="example_db"

DATABASE_URL="postgresql://example_user:example_password@localhost:5432/example_db?schema=public"

PORT=123
2 changes: 1 addition & 1 deletion apps/backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ FROM postgres:15

ENV POSTGRES_USER=${POSTGRES_USER}
ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
ENV POSTGRES_DB=devix_admin
ENV POSTGRES_DB=${POSTGRES_DB}
9 changes: 9 additions & 0 deletions apps/backend/Dockerfile.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM postgres:15

ARG POSTGRES_USER
ARG POSTGRES_PASSWORD
ARG POSTGRES_DB

ENV POSTGRES_USER=${POSTGRES_USER}
ENV POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
ENV POSTGRES_DB=${POSTGRES_DB}
18 changes: 12 additions & 6 deletions apps/backend/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: "3"

services:
devixid:
build:
Expand All @@ -9,13 +7,21 @@ services:
ports:
- "5434:5432"
environment:
POSTGRES_DB: devix_admin
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
env_file:
- .env
devixid_dev:
build:
context: .
dockerfile: Dockerfile
dockerfile: Dockerfile.development
args:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_DB: ${POSTGRES_DB}
image: devixid_dev
env_file:
- .env.development
ports:
- "5435:5432"
environment:
POSTGRES_DB: devix_admin_dev
2 changes: 1 addition & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "dotenv -e .env.test -- jest --config --watch --no-cache ./test/jest-e2e.json",
"pretest:e2e": "yarn db:test:restart"
"pretest:e2e": "pnpm db:test:restart"
},
"lint-staged": {
"**/*.{html,css,scss,less,json,js,jsx,ts,tsx,md,mdx}\"": [
Expand Down
22 changes: 20 additions & 2 deletions apps/backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ datasource db {
url = env("DATABASE_URL")
}

model Portfolio {
id Int @id @default(autoincrement())
title String
description String
url String
image String @db.VarChar(255)
keywords String[]
uploaderId Int
@@index([title, keywords])
}

model User {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
Expand All @@ -18,8 +30,14 @@ model User {
email String @unique
hash String
firstName String?
lastName String?
userName String?
fullName String?
role UserRole @default(ADMIN)
@@map("users")
}

enum UserRole {
ADMIN
SUPER_ADMIN
}
Loading

0 comments on commit 623d098

Please sign in to comment.