Skip to content

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

Add docker scripts and just shim (#1964)

Madison Swain-Bowden2f2b362d7964
diff --git a/README.md b/README.md
index 4bb566bad..1aa6f496e 100644
--- a/README.md
+++ b/README.md
@@ -127,7 +127,7 @@ We do not currently support local development using Docker or `docker-compose`.
However, we do build and actively deploy the frontend using Docker images. If you wish to build the production image for yourself, run the following:
```shell
-docker build . -t openverse-frontend:latest
+pnpm docker:build
```
You can also find the latest `openverse-frontend` images on our [GitHub packages page](https://github.com/WordPress/openverse-frontend/pkgs/container/openverse-frontend).
@@ -135,7 +135,7 @@ You can also find the latest `openverse-frontend` images on our [GitHub packages
You can then run using either the locally built image or the `ghcr.io` image from the link above:
```shell
-docker run --rm -it -p 127.0.0.1:8443:8443/tcp openverse-frontend:latest
+pnpm docker:run
```
The app will be available at <http://localhost:8443>.
@@ -144,7 +144,7 @@ The app will be available at <http://localhost:8443>.
> E.g. this link will not work:
>
> ```
-> $ docker run --rm -it -p 127.0.0.1:8443:8443/tcp openverse-frontend:latest
+> $ pnpm docker:run
>
> > nuxt start
@@ -182,6 +182,10 @@ All files and folders should be written in `kebab-case`, with the exception of V
| ------------ | ----------- | ----------- | ---------------------- |
| /photos/\_id | /image/\_id | 301 | Nuxt server middleware |
+## Just
+
+If [`just`](https://github.com/casey/just) is your preferred command runner, you can also use `just run {script}` to run any pnpm script and `just` on its own to list the available scripts (e.g. `just run docker:build`). Our other projects use `just` as their primary script runner, so this allows parity with both the API and the catalog.
+
## Contributing
Pull requests are welcome! Feel free to [join us on Slack](https://make.wordpress.org/chat/) and discuss the project with the engineers and community members on #openverse.
diff --git a/justfile b/justfile
new file mode 100644
index 000000000..1a32a2ef4
--- /dev/null
+++ b/justfile
@@ -0,0 +1,9 @@
+set dotenv-load := false
+
+# Show all available recipes
+default:
+ pnpm run
+
+# Run a package.json script via pnpm
+run *args:
+ pnpm run {{ args }}
diff --git a/package.json b/package.json
index 40f9ed008..a34d7cbba 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,8 @@
"build": "pnpm build:only",
"build:only": "nuxt build",
"build:clean": "rm -rf .nuxt",
+ "docker:build": "docker build . -t openverse-frontend:latest",
+ "docker:run": "docker run --rm -it -p 127.0.0.1:8443:8443/tcp openverse-frontend:latest",
"generate": "nuxt generate",
"start": "nuxt start",
"prod": "pnpm build:only && pnpm start",