From 76cb73bb0355f454fe461fda84181a58b9cbfcc2 Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Wed, 14 Jun 2023 10:21:52 -0400 Subject: [PATCH] Temporarily configure docker-compose for dev/debug --- Makefile | 7 ++----- docker-compose.yml | 7 ++++++- server/Dockerfile | 6 +++++- server/Dockerfile.debug | 17 +++++++++++++++++ 4 files changed, 30 insertions(+), 7 deletions(-) create mode 100644 server/Dockerfile.debug diff --git a/Makefile b/Makefile index 029f165..274c3d3 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,9 @@ all: start-server client/dist/index.html: cd client; yarn && yarn build -build-client: client/dist/index.html +build-client: client/dist/index.html -server/public/: client/dist/index.html - rsync -a client/dist/ server/public/ - -start-server: server/public/ +start-server: build-client docker compose up --build -d clean: diff --git a/docker-compose.yml b/docker-compose.yml index 041f192..f1e488e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,10 @@ version: "3.5" services: server: - build: ./server + # build: ./server + build: + context: ./server + dockerfile: Dockerfile.debug networks: - web - internal @@ -16,6 +19,8 @@ services: ports: # TODO remove in prod - 8000:8000 + volumes: + - ./client/dist:/src/public:ro database: image: postgres environment: diff --git a/server/Dockerfile b/server/Dockerfile index 07f1cbb..defbb05 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -1,4 +1,8 @@ FROM rustlang/rust:nightly-bullseye-slim +RUN apt-get update &&\ + apt-get install sqlite3 &&\ + apt-get clean &&\ + rm -rf /var/lib/apt/lists WORKDIR /src ADD Cargo.toml Cargo.lock /src/ RUN echo "fn main() {}" > dummy.rs &&\ @@ -8,5 +12,5 @@ ADD src/ src/ RUN rm dummy.rs &&\ sed -i "s:dummy.rs:src/main.rs:" Cargo.toml RUN cargo build --release -ADD public/ public/ +# ADD public/ public/ CMD ["target/release/kalkulog-server"] diff --git a/server/Dockerfile.debug b/server/Dockerfile.debug new file mode 100644 index 0000000..04e659b --- /dev/null +++ b/server/Dockerfile.debug @@ -0,0 +1,17 @@ +FROM rustlang/rust:nightly-bullseye-slim +RUN apt-get update &&\ + apt-get install -yq sqlite3 &&\ + apt-get clean &&\ + rm -rf /var/lib/apt/lists +WORKDIR /src +ADD Cargo.toml Cargo.lock /src/ +RUN echo "fn main() {}" > dummy.rs &&\ + sed -i "s:src/main.rs:dummy.rs:" Cargo.toml +RUN cargo build --release +ADD src/ src/ +RUN rm dummy.rs &&\ + sed -i "s:dummy.rs:src/main.rs:" Cargo.toml +RUN cargo build --release +# ADD public/ public/ +CMD ["target/release/kalkulog-server"] +