add Dockerfile to remove installing rust and add docker-compose and setup.md
This commit is contained in:
parent
5f782cb778
commit
d81233ab42
2
.env
2
.env
|
@ -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
11
Dockerfile
Normal 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
21
SETUP.md
Normal 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
|
||||
```
|
||||
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue