feat: with initial rust service

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-07-01 23:40:16 +02:00
parent 7310e6a15f
commit dce4bf4e36
22 changed files with 76 additions and 166 deletions

View File

@@ -0,0 +1,4 @@
POSTGRES_DB=como
POSTGRES_USER=como
POSTGRES_PASSWORD=somenotverysecurepassword
DATABASE_URL="postgres://como:somenotverysecurepassword@localhost:5432/como"

View File

@@ -1,11 +0,0 @@
FROM rust:1.69.0-slim-buster
RUN apt-get update && apt-get upgrade -y
RUN apt-get install libssl-dev
RUN apt-get install -y -q build-essential curl
COPY . .
RUN cargo build
CMD [ "cargo", "run" ]

View File

@@ -1,2 +0,0 @@
target/
.cuddle/

View File

@@ -1,17 +0,0 @@
version: '3.7'
services:
{{ service }}:
image: {{ image }}
ports:
- {{ port }}
env_file: ".env"
restart: always
depends_on:
- db
db:
image: postgres:13.5
restart: always
env_file: ".env"
volumes:
- ./data/postgres:/var/lib/postgresql/data

View File

@@ -0,0 +1,7 @@
target/
.git/
.cuddle/
scripts/
cuddle.yaml
local.sh
README.md

View File

@@ -0,0 +1,17 @@
version: '3.7'
services:
db:
build:
context: .
dockerfile: local_up.Dockerfile
restart: always
environment:
- POSTGRES_PASSWORD=somenotverysecurepassword
ports:
- 5432:5432
volumes:
- pgdata:/var/lib/postgresql/data
volumes:
pgdata:

View File

@@ -0,0 +1,8 @@
#!bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE USER como WITH PASSWORD 'somenotverysecurepassword';
CREATE DATABASE cuddle;
GRANT ALL PRIVILEGES ON DATABASE cuddle TO cuddle;
EOSQL

View File

@@ -0,0 +1,3 @@
FROM postgres:14-alpine
COPY *.sh /docker-entrypoint-initdb.d/