Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Fix local build of the API and add its `recreate` just command (#994)

Krystle Salazara8a8c4423d7a
diff --git a/api/env.template b/api/env.template
index bcfb0ece1..e7d00266b 100644
--- a/api/env.template
+++ b/api/env.template
@@ -7,7 +7,7 @@ DJANGO_DEBUG_ENABLED=True
BASE_URL=http://localhost:50280/
ENVIRONMENT=development
# List of comma-separated hosts/domain names, e.g., 127.17.0.1,local.app
-ALLOWED_HOSTS=172.17.0.1,host.docker.internal
+ALLOWED_HOSTS=localhost,172.17.0.1,host.docker.internal
#LOAD_BALANCER_URL=
diff --git a/api/justfile b/api/justfile
index 54ae38b8e..3563bea6c 100644
--- a/api/justfile
+++ b/api/justfile
@@ -31,6 +31,11 @@ wait-up: up
init: wait-up
cd .. && ./load_sample_data.sh
+recreate:
+ just ../down -v
+ just up "--force-recreate --build"
+ just init
+
##########
# Health #
##########
diff --git a/docker-compose.yml b/docker-compose.yml
index 4d53a8c5c..b1b4121c6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -110,6 +110,7 @@ services:
- api
build:
context: ./api/
+ target: api
args:
SEMANTIC_VERSION: ${SEMANTIC_VERSION:-v1.0.0}
image: openverse-api