Browse Source

fix up Dockerfile and add docker ignore

Seandon Mooy 3 years ago
parent
commit
7362d1a8ea
2 changed files with 10 additions and 6 deletions
  1. 4 0
      .dockerignore
  2. 6 6
      Dockerfile

+ 4 - 0
.dockerignore

@@ -0,0 +1,4 @@
+Dockerfile
+docker-buildx.sh
+.git
+.github

+ 6 - 6
Dockerfile

@@ -5,7 +5,9 @@ FROM rust:latest as builder
 WORKDIR /usr/src/microbin
 
 # copy sources to /usr/src/microbin on the temporary container
-COPY . .
+COPY Cargo.toml render.yaml .
+COPY templates ./templates
+COPY src ./src
 
 # run release build
 RUN cargo build --release
@@ -13,14 +15,12 @@ RUN cargo build --release
 # create final container using slim version of debian
 FROM debian:buster-slim
 
-# microbin will be in /usr/local/bin/microbin/
-WORKDIR /usr/local/bin
+WORKDIR /app
 
 # copy built exacutable
 COPY --from=builder /usr/src/microbin/target/release/microbin /usr/local/bin/microbin
 
-# copy /static folder containing the stylesheets
-COPY --from=builder /usr/src/microbin/static /usr/local/bin/static
+VOLUME ["/app/pasta_data"]
 
 # run the binary
-CMD ["microbin"]
+CMD ["/usr/local/bin/microbin"]