Browse Source

add docker

master
Chris Mahoney 4 months ago
parent
commit
0139837690
  1. 23
      Dockerfile
  2. 17
      docker-compose.yaml

23
Dockerfile

@ -0,0 +1,23 @@
FROM rust AS builder
WORKDIR /random
# Build dependencies
RUN echo "fn main() {}" > dummy.rs
COPY Cargo.toml .
RUN sed -i 's#src/main.rs#dummy.rs#' Cargo.toml
RUN cargo build --release
RUN sed -i 's#dummy.rs#src/main.rs#' Cargo.toml
# Prepare build
COPY src src
RUN touch src/main.rs
# Build release
RUN cargo build --release
# Run binary
FROM rust:slim
WORKDIR /app
COPY --from=builder /random/target/release/random random
COPY static static
CMD ["./rust_talks"]

17
docker-compose.yaml

@ -0,0 +1,17 @@
version: "3.9"
services:
web:
ports:
- 8004:8004
environment:
VIRTUAL_PORT: 8004
VIRTUAL_HOST: talks.cosi.clarkson.edu,talks.cslabs.clarkson.edu,talks
LETSENCRYPT_HOST: talks.cosi.clarkson.edu,talks.cslabs.clarkson.edu
build:
context: .
networks:
default:
external:
name: nginx-proxy
Loading…
Cancel
Save