Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project setup to run with Docker #86

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<h3>👋 Welcome to StableStudio, the open-source version of <a href="https://dreamstudio.ai" target="_blank">DreamStudio</a>!</h3>

**🗺 Contents – [🚀 Quick Start](#quick-start) · [ℹ️ About](#about) · [🙋 FAQ](#faq) · [🧑‍💻 Contributing](#contributing)**
**🗺 Contents – [🚀 Quick Start](#quick-start) · [🐳 Docker Start](#docker-start) · [ℹ️ About](#about) · [🙋 FAQ](#faq) · [🧑‍💻 Contributing](#contributing)**

**📚 Documentation – [🎨 UI](./packages/stablestudio-ui/README.md) · [🔌 Plugins](./packages/stablestudio-plugin/README.md) · <a href="https://platform.stability.ai" target="_blank">⚡️ platform.stability.ai</a>**

Expand Down Expand Up @@ -43,6 +43,19 @@ StableStudio will be running at [localhost:3000](http://localhost:3000) by defau

> If you are using the default Stability API plugin, You'll need to have your [API key](https://platform.stability.ai/docs/getting-started/authentication) handy. Otherwise, you should be good to go!

# <a id="docker-start" href="#docker-start"> 🐳 Docker Start</a>

The easiest way to launch StableStudio locally is by using docker.
A convenient setup script is provided to help you get started.

```bash
./setup.sh --docker
```

_**That's it! 🎉**_

StableStudio will be running at [localhost:3000](http://localhost:3000) by default.

# <a id="about" href="#about">About</a>

<div style="display: flex; justify-content: center; align-items: center; gap: 1em; margin: 0 0 2em 0;">
Expand Down
13 changes: 13 additions & 0 deletions packages/stablestudio-ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Use the official nginx image as the base image
FROM nginx:1.18.0

# Set the working directory
WORKDIR /stablestudio-ui

# Copy the stablestudio-ui application code
COPY ./dist ./

COPY ./nginx-default.conf /etc/nginx/conf.d/default.conf

# Expose the port the app will run on
EXPOSE 80
17 changes: 17 additions & 0 deletions packages/stablestudio-ui/nginx-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
server{
listen 80;
server_name localhost;
root /stablestudio-ui;
index index.html;
charset utf-8;
# By default, Nginx has a limit of 1MB on file uploads. To set file upload size
client_max_body_size 100M;

location / {
if ($request_filename ~* ^.*?.(html|htm)$){
expires -1s;
add_header Cache-Control no-cache,no-store,must-revalidate;
}
try_files $uri $uri/ /index.html;
}
}
13 changes: 13 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
cd "$(dirname "$0")" || exit

if [ "$1" = "--docker" ]; then
APP_NAME="stablestudio-ui"
yarn install
yarn build
docker image build -t $APP_NAME -f ./packages/$APP_NAME/Dockerfile ./packages/$APP_NAME/
docker run -d --name $APP_NAME -p 3000:80 $APP_NAME
else
yarn install
yarn dev
fi