chore: update docker & makefile

This commit is contained in:
Sonny
2023-10-24 16:55:20 +02:00
parent 1a8e4e7270
commit 8558f5e979
8 changed files with 44 additions and 47 deletions

View File

@@ -3,3 +3,11 @@ node_modules
.next .next
.vscode .vscode
example.env example.env
# Additional good to have ignores for dockerignore
Dockerfile*
docker-compose*
.dockerignore
*.md
.git
.gitignore

View File

@@ -4,7 +4,6 @@ WORKDIR /app
COPY ./ /app COPY ./ /app
RUN npm install RUN npm install
RUN npx prisma generate
RUN npm run build RUN npm run build
EXPOSE 3000 EXPOSE 3000

View File

@@ -14,8 +14,5 @@ start-dev:
@echo 'Dont forget to do migrations before run dev' @echo 'Dont forget to do migrations before run dev'
start-prod: prod:
docker-compose --env-file ../.env -f ./docker-compose.yml up -d docker compose up -d --build
build:
docker build -f ./Dockerfile -t sonny/my-links ../

View File

@@ -5,6 +5,6 @@ services:
image: mysql:latest image: mysql:latest
restart: always restart: always
env_file: env_file:
- ../.env - .env
ports: ports:
- 3306:3306 - 3306:3306

28
docker-compose.yml Normal file
View File

@@ -0,0 +1,28 @@
version: "3.8"
volumes:
db_volume_data:
driver: local
services:
mylinks_db:
image: mysql:latest
restart: always
volumes:
- db_volume_data:/var/lib/postgresql/data
- ./docker-config/mysql-dev-init.sql:/docker-entrypoint-initdb.d/init.sql
env_file:
- .env
mylinks:
restart: always
container_name: MyLinks
build:
context: .
ports:
- 3000:3000
env_file:
- .env
depends_on:
mylinks_db:
condition: service_started

View File

@@ -0,0 +1 @@
CREATE DATABASE mylinks;

View File

@@ -1,36 +0,0 @@
version: "3.8"
volumes:
db_volume_data:
driver: local
networks:
my_links_net:
name: my_links_net
services:
my-links-db:
image: mysql:latest
restart: always
volumes:
- db_volume_data:/var/lib/postgresql/data
env_file:
- ../.env
networks:
- my_links_net
my-links:
image: sonny/my-links:latest
container_name: MyLinks
ports:
- 3000:3000
restart: always
env_file:
- ../.env
environment:
DATABASE_URL: "mysql://${MYSQL_USER}:${MYSQL_PASSWORD}@my-links-db:3306/${MYSQL_DATABASE}"
depends_on:
my-links-db:
condition: service_started
networks:
- my_links_net

View File

@@ -1,7 +1,7 @@
MYSQL_USER="my-user" MYSQL_USER="my-user"
MYSQL_PASSWORD="my-user_passwd" MYSQL_PASSWORD="my-user_passwd"
MYSQL_ROOT_PASSWORD="root_passwd" MYSQL_ROOT_PASSWORD="root_passwd"
MYSQL_DATABASE="MyLinks" MYSQL_DATABASE="mylinks"
# Or if you need external Database # Or if you need external Database
# DATABASE_IP="localhost" # DATABASE_IP="localhost"