@ -0,0 +1,16 @@ | |||||
Build and run : | |||||
. run.sh | |||||
terminate with : | |||||
Ctrl-C | |||||
then: | |||||
cd .. | |||||
@ -0,0 +1 @@ | |||||
DATABASE_URL=mysql://rocket_user:rocket_pw@mariadb/rocket_db |
@ -0,0 +1,24 @@ | |||||
FROM rustlang/rust:nightly | |||||
WORKDIR /usr/src | |||||
RUN apt-get update | |||||
RUN git clone https://basabuuka.zapto.org/xsiva/rocket-3d.git | |||||
RUN cargo install --path ./rocket-3d | |||||
WORKDIR /usr/src/rocket-3d | |||||
COPY Rocket.toml /usr/src/rocket-3d/Rocket.toml | |||||
COPY .env /usr/src/rocket-3d/.env | |||||
RUN cargo install cargo-watch | |||||
# RUN cargo install diesel_cli --no-default-features --features "mysql" | |||||
# RUN diesel setup | |||||
CMD ROCKET_ENV=debug cargo watch -x 'run --bin rocket-3d' | |||||
@ -0,0 +1,11 @@ | |||||
local_build: | |||||
docker build -t rocket_local_dev -f Dockerfile . | |||||
local_run: | |||||
docker run --rm -it -p 5000:5000 --mount source="$(shell pwd)",target=/usr/src,type=bind --name rocket-server rocket_local_dev cargo watch -x 'run --bin rocket-3d' | |||||
local_stop: | |||||
docker stop rocket | |||||
local_shell: | |||||
docker run --rm -it -p 5000:5000 --mount source="$(shell pwd)",target=/usr/src,type=bind --name rocket-server rocket_local_dev |
@ -0,0 +1,7 @@ | |||||
[debug] | |||||
address = "0.0.0.0" | |||||
port = 5000 | |||||
[default] | |||||
template_dir = "templates" |
@ -0,0 +1,47 @@ | |||||
version: "3.4" | |||||
services: | |||||
deb-rust: | |||||
container_name: deb-rust | |||||
restart: always | |||||
build: ../build/deb-rust | |||||
environment: | |||||
- RUST_BACKTRACE=1 | |||||
- DATABASE_URL=mysql://rocket_user:rocket_pw@0.0.0.0:3306/rocket_db | |||||
ports: | |||||
- "5000:5000" | |||||
networks: | |||||
- rocket-db | |||||
#depends_on: | |||||
#- mariadb | |||||
#links: | |||||
#- "mariadb" | |||||
#mariadb: | |||||
#image: mariadb:latest | |||||
#container_name: mariadb | |||||
#hostname: mariadb | |||||
#restart: always | |||||
#volumes: | |||||
#- "mariadb_vol:/var/lib/mysql" | |||||
#ports: | |||||
#- "3306:3306" | |||||
#environment: | |||||
#- MYSQL_ROOT_PASSWORD=password | |||||
#- MYSQL_PASSWORD=rocket_pw | |||||
#- MYSQL_DATABASE=rocket_db | |||||
#- MYSQL_USER=rocket_user | |||||
#networks: | |||||
#- rocket-db | |||||
networks: | |||||
rocket-db: | |||||
driver: bridge | |||||
volumes: | |||||
maria-data: | |||||
driver: local | |||||
mariadb_vol: | |||||
@ -0,0 +1,21 @@ | |||||
version: "3.4" | |||||
services: | |||||
deb-rust-rocket: | |||||
container_name: "deb-rust-rocket" | |||||
command: cargo watch -x 'run --bin rocket-3d' | |||||
build: | |||||
dockerfile: Dockerfile | |||||
context: ../build/deb-rust | |||||
cache_from: | |||||
- rustlang/rust:nightly | |||||
networks: | |||||
- library-network | |||||
tty: true | |||||
wq | |||||
volumes: | |||||
- type: bind | |||||
source: ./ | |||||
target: /usr/src | |||||
ports: | |||||
- "5000:5000" |
@ -0,0 +1,25 @@ | |||||
#!/bin/bash | |||||
trap "cd '..'" TERM INT | |||||
# run docker-container | |||||
run() { | |||||
cd "compose" && \ | |||||
docker-compose build --no-cache deb-rust && \ | |||||
docker-compose up && \ | |||||
} | |||||
run | |||||
#to do: | |||||
# ctrl-c(sigint): | |||||
# stop and remove container(with custom message) | |||||
# cd .. | |||||