add Dockerfile to remove installing rust and add docker-compose and setup.md

This commit is contained in:
Mika Bomm 2024-10-09 11:54:00 +02:00
parent 5f782cb778
commit d81233ab42
4 changed files with 49 additions and 2 deletions

2
.env
View file

@ -1,2 +1,2 @@
DATABASE_URL=postgres://apfel:apfel@localhost:5432/apfel
DATABASE_URL=postgres://apfel:apfel@db:5432/apfel
TOKEN_SECRET=9b2cbd156a7a7e0e530acd780fdd16e8f37fa3fd8122c74a9b7e1ce6fc67980ed0e55572be4e382679a0c13d13f0a651d15e9e877bb579e957c899eb762b1bb4

11
Dockerfile Normal file
View file

@ -0,0 +1,11 @@
FROM rust:latest
COPY ./crates/ ./crates/
COPY ./Cargo.toml ./
COPY ./Cargo.lock ./
RUN cargo build --release
CMD ["./target/release/backend"]
EXPOSE 8080

21
SETUP.md Normal file
View file

@ -0,0 +1,21 @@
# How to setup the Project
## Table of Contents
1. [Prerequisites](#prerequisites)
2. [Setup](#setup)
---
# Prerequisites
Docker installed on the system.
For the frontend it might be necessary to install pnpm and its requirements
For a production environment you may change the database user/password in the `.env` file and the corresponding `dev-compose.yml` or build your own!
# Setup
To execute the database and backend run the following command in the root directory of the project
```bash
docker compose -f dev-compose.yml up -d
```

View file

@ -12,11 +12,26 @@ services:
ports:
- "5432:5432"
networks:
- apfelnetzwerk
restart: unless-stopped
backend:
container_name: apfelnetzwerk-backend
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
networks:
- apfelnetzwerk
depends_on:
- db
env_file:
- .env
restart: unless-stopped
networks:
db:
apfelnetzwerk:
driver: bridge
volumes: