diff --git a/Dockerfile b/Dockerfile index a3761be..d972b81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 FROM rust:alpine AS chef WORKDIR /app RUN apk add --no-cache build-base diff --git a/Justfile b/Justfile index 24ea94e..8727f34 100644 --- a/Justfile +++ b/Justfile @@ -10,10 +10,16 @@ docker-build-quiet: docker build --build-arg COMMIT_SHA="{{COMMIT_SHA}}" --quiet . docker-run: - docker run --env OPENAI_API_KEY --publish 8080:8080 "$(just docker-build-quiet)" + docker run --rm --env OPENAI_API_KEY --publish 8080:8080 "$(just docker-build-quiet)" + +docker-sh: + docker run --rm --env OPENAI_API_KEY --publish 8080:8080 -it "$(just docker-build-quiet)" sh deploy: fly deploy --build-arg COMMIT_SHA="{{COMMIT_SHA}}" -logs: - fly logs +local PATH: + http -v --stream --auth "user:${HTTP_BASIC_AUTH_PASSWORD}" localhost:8080/{{PATH}} + +remote PATH: + https -v --stream --auth "user:${HTTP_BASIC_AUTH_PASSWORD}" gpt.dtcristo.com/{{PATH}} diff --git a/README.md b/README.md index 707162e..617f5fa 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Get an [OpenAI API key](https://platform.openai.com/account/api-keys). Run local export OPENAI_API_KEY="your_api_key_here" # Build and run in Docker. -docker run --env OPENAI_API_KEY --publish 8080:8080 "$(docker build --quiet .)" +docker run --rm --env OPENAI_API_KEY --publish 8080:8080 "$(docker build --quiet .)" ``` Application live at [localhost:8080](http://localhost:8080/). diff --git a/src/main.rs b/src/main.rs index 159be39..4bb04e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,6 +14,7 @@ async fn main() { println!("Starting server..."); let addr = if env::docker() { + env::print(); SocketAddr::from(([0, 0, 0, 0], 8080)) } else { SocketAddr::from(([127, 0, 0, 1], 8080)) diff --git a/src/web/health.rs b/src/web/health.rs index 4a7bf80..f90e4fa 100644 --- a/src/web/health.rs +++ b/src/web/health.rs @@ -19,8 +19,6 @@ pub async fn handler() -> Result { println!("\n----------"); println!("Health"); - env::print(); - env::openai_api_key().ok_or(Error::EnvironmentError)?; let time = SystemTime::now()