Skip to content

Commit

Permalink
start work on docker-compose dev build
Browse files Browse the repository at this point in the history
  • Loading branch information
kmurf1999 committed Dec 18, 2020
1 parent da4c3aa commit c8b60f5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
19 changes: 19 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules/
.pnp/
.pnp.js

# testing
coverage/

# production
build/
target/

# misc
.DS_Store

npm-debug.log*
yarn-debug.log*
14 changes: 10 additions & 4 deletions backend/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
FROM rust:1.43
FROM rust

RUN mkdir -p /server
WORKDIR /server

COPY -r src/ /server
COPY Cargo.* /server
# install dependencies seperately for caching
# COPY "Cargo.toml" .
# RUN echo "fn main() {}" > dummy.rs
# RUN sed -i 's#src/main.rs#dummy.rs#' Cargo.toml
# RUN cargo build
# RUN sed -i 's#dummy.rs#src/main.rs#' Cargo.toml

# copy files
COPY . .

CMD "cargo" "run"
1 change: 1 addition & 0 deletions backend/dummy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main(){}
4 changes: 2 additions & 2 deletions backend/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async fn main() {
)
});

log::info!("Listening on 127.0.0.1:4000");
log::info!("Listening on 127.0.0.1:3000");

let state = warp::any().map(|| Context);
let graphql_filter = juniper_warp::make_graphql_filter(schema(), state.boxed());
Expand All @@ -99,6 +99,6 @@ async fn main() {
.or(warp::path("graphql").and(graphql_filter))
.with(log),
)
.run(([127, 0, 0, 1], 4000))
.run(([127, 0, 0, 1], 3000))
.await
}
4 changes: 2 additions & 2 deletions docker.compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- "./frontend:/app"
- "/app/node_modules"
ports:
- 3001:3000
- 3000:3000
stdin_open: true

backend: # Rust graqhl server
Expand All @@ -20,7 +20,7 @@ services:
volumes:
- "./backend:/server"
ports:
- 4001:4000
- 3001:3001

db: # postgresql database
image: postgres
Expand Down

0 comments on commit c8b60f5

Please sign in to comment.