Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from UCBoulder/Bookstore-Updates-to-Low-Cost-No…
Browse files Browse the repository at this point in the history
…-Cost-and-OER-Fields

update the readme; slim down the image
  • Loading branch information
d33bs authored Aug 23, 2021
2 parents ac7f4b3 + d415859 commit a004c07
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8-slim
LABEL org.opencontainers.image.source https://github.com/UCBoulder/Bookstore-FASTAPI-Integrations

COPY requirements.txt ./requirements.txt
Expand Down
48 changes: 33 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
# Bookstore REST API

Provides RESTful API interface(s) for UCB Bookstore data.

Config variables -- other than those passed in by environment are in the config.py file.

To run the app in local development with reload,
```
GRAPHQL_KEY=hasura_graphql_api_key BASIC_USERNAME=books BASIC_PASSWORD=default uvicorn app.main:app --reload
```
## Local Development

In Windows, this works too:
```
set GRAPHQL_KEY=*********** set BASIC_USERNAME=books set BASIC_PASSWORD=password uvicorn app.main:app --reload
### Environment Vars

Set environment variables for GRAPHQL_KEY, BASIC_USERNAME, and BASIC_PASSWORD. For ex:

```shell
#bash
export KEYNAME="123"

#windows cmd
set KEYNAME=123

#windows powershell
$Env:KEYNAME="123"
```

### Format, Lint, Test, and Run

1. To format your code, run `make format`
1. To lint your code, run `make lint`
1. To test your code, run `make tests`
1. To run uvicorn locally, run `make uvicorn-run`

## Container'ing

```
docker build -t bookstore-api .
docker run -d --name bookstore-api \
-p 8988:80 \
-e GRAPHQL_KEY=**** \
-e BASIC_USERNAME=books \
-e BASIC_PASSWORD=password \
bookstore-api
### Build

```shell
make docker-build
```

### Run

```shell
make docker-run
```

0 comments on commit a004c07

Please sign in to comment.