Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

Add local docker db setup (#43)

Sean Boult9aeb12dc4e01
diff --git a/.env.example b/.env.example
index 8d5740a7..1455ab1e 100644
--- a/.env.example
+++ b/.env.example
@@ -1,3 +1,3 @@
-DATABASE_URL="mysql://<username>:<password>@<some-url>"
+DATABASE_URL="mysql://dev:dev@localhost/typehero"
GITHUB_ID=
GITHUB_SECRET=
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d3177c29..8e12c077 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -9,7 +9,17 @@ machine. Below are the steps to follow in order for you to get dotfyle to run on
cp .env.example .env
```
-### 2. Setup planetscale.
+### 2 Configure your database
+You can either use planetscale or a local docker container to run your database.
+Use either 2.a or 2.b for the next step.
+
+### 2.a Docker local DB
+
+Starting the docker container
+```
+docker compose up -d
+```
+### 2.b Planetscale cloud DB
[Follow the planetscale quick start guide to get you connection string][planetscale-quick-start]
@@ -93,3 +103,4 @@ pnpx prisma db seed
[planetscale-quick-start]: https://planetscale.com/docs/tutorials/planetscale-quick-start-guide
[new-oauth]: https://github.com/settings/applications/new
+
diff --git a/docker-compose.yaml b/docker-compose.yaml
new file mode 100644
index 00000000..84b45bcd
--- /dev/null
+++ b/docker-compose.yaml
@@ -0,0 +1,22 @@
+# create a docker image with mysql and a default password of admin
+version: '3'
+
+services:
+ db:
+ image: bitnami/mysql:latest
+ container_name: db
+ restart: always
+ environment:
+ MYSQL_ROOT_USER: dev
+ MYSQL_ROOT_PASSWORD: dev
+ MYSQL_DATABASE: typehero
+
+ # create a volume for the docker container_name
+ volumes:
+ - data:/bitnami/mysql/data
+ platform: linux/amd64
+ ports:
+ - 3306:3306
+volumes:
+ data:
+ driver: local