Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcristo committed Apr 28, 2023
1 parent e70f67f commit c186c0b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1
FROM rust:alpine AS chef
WORKDIR /app
RUN apk add --no-cache build-base
Expand Down
12 changes: 9 additions & 3 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 0 additions & 2 deletions src/web/health.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ pub async fn handler() -> Result<impl IntoResponse> {
println!("\n----------");
println!("Health");

env::print();

env::openai_api_key().ok_or(Error::EnvironmentError)?;

let time = SystemTime::now()
Expand Down

0 comments on commit c186c0b

Please sign in to comment.