Merge pull request 'chore: add development docker environment' (#77)
All checks were successful
container-scan / Container Scan (push) Successful in 3m33s
docker-build / docker (push) Successful in 5m37s

Reviewed-on: #77
Reviewed-by: Maximilian Liebmann <lima@noreply.git.dominikstahl.dev>
This commit is contained in:
Dominik 2025-06-09 08:12:45 +00:00
commit 4b80c89050
5 changed files with 64 additions and 1 deletions

17
Dockerfile.dev Normal file
View file

@ -0,0 +1,17 @@
FROM node:22-alpine@sha256:152270cd4bd094d216a84cbc3c5eb1791afb05af00b811e2f0f04bdc6c473602
WORKDIR /app
RUN corepack enable
COPY package.json yarn.lock .yarnrc.yml ./
RUN yarn install --frozen-lockfile
COPY . .
ENV NODE_ENV=development
ENV NEXT_TELEMETRY_DISABLED=1
EXPOSE 3000
ENV HOSTNAME="0.0.0.0"
CMD ["/bin/ash", "entrypoint.dev.sh"]

View file

@ -129,6 +129,14 @@ This project is built with a modern tech stack:
password: password
```
**Docker Development Environment:**
- The docker development environment can be started with the following command:
```bash
yarn dev_container
```
**Self-Hosting with Docker (Planned):**
- A Docker image and `docker-compose.yml` file will be provided in the future to allow for easy self-hosting of the MeetUP application. This setup will also include database services. Instructions will be updated here once available.

27
docker-compose.dev.yml Normal file
View file

@ -0,0 +1,27 @@
services:
app:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- '3000:3000'
environment:
- AUTH_SECRET=secret
- AUTH_URL=http://localhost:3000
- DATABASE_URL=file:/data/db.sqlite
env_file:
- .env.local
volumes:
- ./data:/data
develop:
watch:
- action: sync
path: ./src
target: /app/src
ignore:
- node_modules/
- action: rebuild
path: package.json
- action: sync+restart
path: prisma
target: /app/prisma

10
entrypoint.dev.sh Normal file
View file

@ -0,0 +1,10 @@
#!/bin/bash
echo "Running start script with user $(whoami) and NODE_ENV $NODE_ENV"
if [ -d "prisma" ]; then
echo "Syncing Prisma database"
yarn prisma:generate
yarn prisma:db:push
fi
exec yarn dev

View file

@ -12,7 +12,8 @@
"prisma:generate": "dotenv -e .env.local -- prisma generate",
"prisma:studio": "dotenv -e .env.local -- prisma studio",
"prisma:db:push": "dotenv -e .env.local -- prisma db push",
"prisma:migrate:reset": "dotenv -e .env.local -- prisma migrate reset"
"prisma:migrate:reset": "dotenv -e .env.local -- prisma migrate reset",
"dev_container": "docker compose -f docker-compose.dev.yml up --watch --build"
},
"dependencies": {
"@auth/prisma-adapter": "^2.9.1",