-
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
12 changed files
with
141 additions
and
42 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,55 @@ | ||
name: Build and Deploy Backend | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./backend | ||
push: true | ||
tags: franciszekszeptycki/ecommerce-tbeitw:latest | ||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: build-and-push | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up SSH | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
|
||
- name: Create SSH private key file | ||
run: | | ||
echo "$SSH_PRIVATE_KEY" > ./ssh-private-key | ||
shell: bash | ||
|
||
- name: Run deploy.sh | ||
run: | | ||
ssh -o StrictHostKeyChecking=no -i ./ssh-private-key ${{ secrets.USER }}@${{ secrets.HOST }} '~/deploy.sh' | ||
shell: bash |
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 |
---|---|---|
|
@@ -3,4 +3,5 @@ venv | |
.idea | ||
.env | ||
__pycache__ | ||
db.sqlite3 | ||
db.sqlite3 | ||
docker-compose.yml |
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,4 +1,5 @@ | ||
media/* | ||
!media/placeholder.jpg | ||
!media/hero-placeholder.jpg | ||
static/* | ||
static/* | ||
.env.backup |
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,14 @@ | ||
FROM python:3.10 | ||
|
||
RUN useradd -m django-user | ||
USER django-user | ||
|
||
WORKDIR /app | ||
|
||
COPY requirements.txt requirements.txt | ||
RUN pip install -r requirements.txt | ||
COPY . . | ||
|
||
HEALTHCHECK CMD curl --fail http://localhost:8000/admin/ || exit 1", | ||
CMD ["./entrypoint.sh", "python", "-m", "gunicorn", "backend.wsgi:application", "-b", "0.0.0.0:8000"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# python manage.py collectstatic --noinput | ||
python manage.py migrate | ||
|
||
exec "$@" |
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,17 +1,27 @@ | ||
asgiref==3.8.1 | ||
boto3==1.34.74 | ||
botocore==1.34.74 | ||
dj-database-url==2.1.0 | ||
Django==5.0.3 | ||
django-cors-headers==4.3.1 | ||
django-dotenv==1.4.2 | ||
django-jazzmin==2.6.1 | ||
django-storages==1.14.2 | ||
djangorestframework==3.15.1 | ||
drf-yasg==1.21.7 | ||
gunicorn==21.2.0 | ||
inflection==0.5.1 | ||
jmespath==1.0.1 | ||
packaging==24.0 | ||
pillow==10.2.0 | ||
psycopg2-binary==2.9.9 | ||
python-dateutil==2.9.0.post0 | ||
python-dotenv==1.0.1 | ||
pytz==2024.1 | ||
PyYAML==6.0.1 | ||
s3transfer==0.10.1 | ||
six==1.16.0 | ||
sqlparse==0.4.4 | ||
typing_extensions==4.10.0 | ||
uritemplate==4.1.1 | ||
|
||
pip~=22.0.2 | ||
setuptools~=59.6.0 | ||
urllib3==2.2.1 |
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
18 changes: 18 additions & 0 deletions
18
backend/store/migrations/0005_websiteconfig_slider_images.py
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 @@ | ||
# Generated by Django 5.0.3 on 2024-04-03 18:20 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('store', '0004_websiteconfig_delete_heroconfig'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='websiteconfig', | ||
name='slider_images', | ||
field=models.ManyToManyField(related_name='sliders', to='store.productgallery'), | ||
), | ||
] |
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
This file was deleted.
Oops, something went wrong.