Skip to content

Commit

Permalink
adds config for fly deployment, tailwind and changes to relative url …
Browse files Browse the repository at this point in the history
…to avoid http
  • Loading branch information
Gökberk Şahin committed Feb 4, 2024
1 parent 18caf98 commit 5e6b984
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 740 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ dmypy.json
# Cython debug symbols
cython_debug/

# Tailwind css output
**/tailwind.css

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand Down
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM python:3.9

WORKDIR /code

# Requirements
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# Copy the fastapi app
COPY ./app /code/app

# Compile and minify tailwind for production
RUN curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64
RUN chmod +x ./tailwindcss-linux-x64
RUN mv ./tailwindcss-linux-x64 ./tailwindcss
RUN ./tailwindcss -i /code/app/static/css/input.css -o /code/app/static/css/tailwind.css -c /code/app/tailwind.config.js --minify

WORKDIR /code/app

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080", "--proxy-headers"]
3 changes: 2 additions & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from playlistfy import Playlistify
from fastapi.staticfiles import StaticFiles


# Jinja2 template engine
templates = Jinja2Templates(directory="templates")

Expand All @@ -31,6 +32,7 @@
origins = [
"http://localhost:3000",
"http://localhost:8000",
"https://playlistify.fly.dev",
]
app.add_middleware(
CORSMiddleware,
Expand All @@ -40,7 +42,6 @@
allow_headers=["*"],
)


# Dependencies
def get_spotify_oauth(request: Request):
return SpotifyOAuth(
Expand Down
Loading

0 comments on commit 5e6b984

Please sign in to comment.