🎉 Initial docker boilerplate for the crts app

main
Pau Costa 2024-01-18 18:26:42 +01:00
parent 856c6c52e1
commit 893eefb16a
6 changed files with 54 additions and 0 deletions

3
.gitignore vendored
View File

@ -1,3 +1,4 @@
# ---> Rust
# Generated by Cargo
# will have compiled files and executables
@ -14,3 +15,5 @@ Cargo.lock
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
.vscode
.idea

7
Cargo.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "crts"
version = "0.1.0"

8
Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[package]
name = "crts"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM rust:latest
WORKDIR /app/
COPY . .
ENV CARGO_HTTP_MULTIPLEXING=false
RUN cargo install diesel_cli --no-default-features --features "postgres"
RUN cargo install cargo-watch
CMD ["cargo", "watch", "--why", "-x", "build"]

21
docker-compose.yml Normal file
View File

@ -0,0 +1,21 @@
version: '3.3'
services:
postgres:
image: postgres:latest
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=app_db
command: ["postgres", "-c", "log_statement=all"]
redis:
image: redis:latest
app:
build: .
environment:
- DATABASE_URL=postgres://postgres:postgres@postgres/app_db
ports:
- "8123:8000"
volumes:
- ./:/app/

3
src/main.rs Normal file
View File

@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}