-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
82 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fly.toml | ||
.git/ | ||
*.sqlite3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ | ||
|
||
name: Fly Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
deploy: | ||
name: Deploy app | ||
runs-on: ubuntu-latest | ||
concurrency: deploy-group # optional: ensure only one action runs at a time | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
FROM python:3.12.6 | ||
ARG PYTHON_VERSION=3.12-slim | ||
|
||
WORKDIR /app | ||
FROM python:${PYTHON_VERSION} | ||
|
||
# Install system dependencies | ||
RUN apt-get update && apt-get install curl -y \ | ||
build-essential \ | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# install psycopg2 dependencies. | ||
RUN apt-get update && apt-get install -y \ | ||
libpq-dev \ | ||
gcc \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& pip install --upgrade pip setuptools wheel \ | ||
&& pip install uv | ||
|
||
COPY ./pyproject.toml ./pyproject.toml | ||
RUN mkdir -p /code | ||
|
||
COPY ./home ./home | ||
COPY ./portfolio ./portfolio | ||
COPY ./staticfiles ./staticfiles | ||
COPY ./static ./static | ||
COPY ./templates ./templates | ||
COPY ./db.sqlite3 ./db.sqlite3 | ||
COPY ./manage.py ./manage.py | ||
WORKDIR /code | ||
|
||
RUN pip install poetry | ||
COPY ./pyproject.toml ./pyproject.toml | ||
RUN uv pip compile pyproject.toml --extra dev -o requirements.txt --extra-index-url https://pypi.org/simple/ --no-cache | ||
RUN pip install -r requirements.txt --extra-index-url https://pypi.org/simple/ --no-cache | ||
RUN python manage.py migrate | ||
COPY . /code | ||
|
||
ENV SECRET_KEY "mMV6vgXTs9qs3flESOrCkA0WDwgO96rWtnoTKqiaRAJug9u5qU" | ||
RUN python manage.py collectstatic --noinput | ||
CMD ["python", "manage.py", "runserver"] | ||
# Run the application using a WSGI server | ||
# CMD ["gunicorn", "--bind", "0.0.0.0:8000", "portfolio.wsgi:application"] | ||
|
||
EXPOSE 8000 | ||
|
||
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--worker-class", "uvicorn.workers.UvicornWorker", "handlers.asgi"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: gunicorn portfolio.wsgi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# fly.toml app configuration file generated for portfolio-shy-frost-4034 on 2024-10-21T22:51:31+02:00 | ||
# | ||
# See https://fly.io/docs/reference/configuration/ for information about how to use this file. | ||
# | ||
|
||
app = 'portfolio-shy-frost-4034' | ||
primary_region = 'cdg' | ||
console_command = '/code/manage.py shell' | ||
|
||
[build] | ||
|
||
[deploy] | ||
release_command = 'python manage.py migrate --noinput' | ||
|
||
[env] | ||
PORT = '8000' | ||
|
||
[http_service] | ||
internal_port = 8000 | ||
force_https = true | ||
auto_stop_machines = 'stop' | ||
auto_start_machines = true | ||
min_machines_running = 0 | ||
processes = ['app'] | ||
|
||
[[vm]] | ||
memory = '1gb' | ||
cpu_kind = 'shared' | ||
cpus = 1 | ||
|
||
[[statics]] | ||
guest_path = '/code/static' | ||
url_prefix = '/static/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters