diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5e56ff3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM node:20-alpine +WORKDIR /usr/src/app +COPY package*.json ./ +RUN npm ci --omit=dev +COPY . . +EXPOSE 3000 +CMD ["node","server.js"] diff --git a/README.md b/README.md index 015f235..7b9687b 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,17 @@ PORT=3000 NODE_ENV=development ``` +## Docker Usage + +To run Wirebase locally with Docker: + +1. Create a `.env` file using the environment variables shown above. +2. Build and start the containers: + ```bash + docker-compose up --build + ``` + The app will be available at `http://localhost:3000`. + ## License This project is available under the MIT License. See the [LICENSE](LICENSE) file for details. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b9c9758 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3.8' +services: + app: + build: . + ports: + - "3000:3000" + environment: + - PORT=3000 + - DATABASE_URL=postgres://postgres:postgres@db:5432/wirebase + - SUPABASE_URL=${SUPABASE_URL} + - SUPABASE_KEY=${SUPABASE_KEY} + - SUPABASE_SERVICE_KEY=${SUPABASE_SERVICE_KEY} + - SESSION_SECRET=${SESSION_SECRET} + depends_on: + - db + db: + image: postgres:15-alpine + environment: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: wirebase + volumes: + - db-data:/var/lib/postgresql/data +volumes: + db-data: