File tree 8 files changed +38
-41
lines changed
8 files changed +38
-41
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 31
31
pip install pipenv
32
32
pipenv install --system --dev
33
33
- uses : pavelzw/pytest-action@v2
34
+ env :
35
+ SECRET_KEY : ${{ secrets.DJANGO_SECRET_KEY }}
34
36
with :
35
37
emoji : false
Original file line number Diff line number Diff line change @@ -2,18 +2,14 @@ FROM python:3.11-alpine
2
2
3
3
WORKDIR /app
4
4
5
- # Instalar paquetes necesarios para construir psycopg2 y otras dependencias, y netcat para comprobar la conexión de la base de datos
6
5
RUN apk add --no-cache gcc musl-dev python3-dev libffi-dev postgresql-dev
7
6
RUN apk add --no-cache netcat-openbsd
8
7
9
- # Install pipenv
10
8
RUN pip install --upgrade pip
11
9
RUN pip install pipenv
12
10
13
- # Install application dependencies
14
11
COPY Pipfile Pipfile.lock /app/
15
- # We use the --system flag so packages are installed into the system python
16
- # and not into a virtualenv. Docker containers don't need virtual environments.
12
+
17
13
RUN pipenv install --system --dev
18
14
19
15
COPY . /app/
Original file line number Diff line number Diff line change
1
+ FROM python:3.11-alpine
2
+
3
+ WORKDIR /app
4
+
5
+ RUN apk add --no-cache gcc musl-dev libffi-dev postgresql-dev bash
6
+
7
+ RUN pip install --upgrade pip
8
+ RUN pip install pipenv
9
+
10
+ COPY Pipfile Pipfile.lock /app/
11
+
12
+ RUN pipenv install --system --deploy
13
+
14
+ COPY . /app/
15
+ COPY docker-entrypoint.sh /app/
16
+ RUN chmod +x /app/docker-entrypoint.sh
17
+
18
+ EXPOSE 8000
19
+
20
+ ENTRYPOINT [ "./docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change @@ -4,9 +4,6 @@ services:
4
4
db :
5
5
container_name : db
6
6
image : postgres:latest
7
- environment :
8
- - POSTGRES_USER=postgres
9
- - POSTGRES_PASSWORD=postgres
10
7
volumes :
11
8
- postgres_data:/var/lib/postgresql/data
12
9
ports :
@@ -17,7 +14,7 @@ services:
17
14
web :
18
15
build :
19
16
context : .
20
- dockerfile : Dev. Dockerfile
17
+ dockerfile : Dockerfile
21
18
container_name : web
22
19
volumes :
23
20
- .:/app
@@ -28,6 +25,13 @@ services:
28
25
- db
29
26
networks :
30
27
- app_network
28
+ environment :
29
+ POSTGRES_DB : ${DB_NAME}
30
+ POSTGRES_USER : ${DB_USER}
31
+ POSTGRES_PASSWORD : ${DB_PASSWORD}
32
+ POSTGRES_PORT : ${DB_PORT}
33
+ POSTGRES_HOST : ${DB_HOST}
34
+ DJANGO_SETTINGS_MODULE : piggywallet.settings.prod
31
35
32
36
networks :
33
37
app_network :
Original file line number Diff line number Diff line change 6
6
7
7
def main ():
8
8
"""Run administrative tasks."""
9
- os .environ .setdefault ("DJANGO_SETTINGS_MODULE" , "piggywallet.settings.dev" )
10
- # os.environ.setdefault("DJANGO_CONFIGURATION", "piggywallet.settings.prod")
9
+ os .environ .setdefault ("DJANGO_CONFIGURATION" , "piggywallet.settings" )
11
10
try :
12
11
from django .core .management import execute_from_command_line
13
12
except ImportError as exc :
Original file line number Diff line number Diff line change 11
11
"""
12
12
13
13
from pathlib import Path
14
+ import os
15
+ from dotenv import load_dotenv
14
16
17
+ load_dotenv ()
15
18
# Build paths inside the project like this: BASE_DIR / 'subdir'.
16
19
BASE_DIR = Path (__file__ ).resolve ().parent .parent
17
20
20
23
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
21
24
22
25
# SECURITY WARNING: keep the secret key used in production secret!
23
- SECRET_KEY = "django-insecure-epw6&76ijtauz9tb6p+a%-&gdfwtuao3p6@p9v=230r_0zd2l+"
24
-
25
- # SECURITY WARNING: don't run with debug turned on in production!
26
- DEBUG = True
27
-
28
- ALLOWED_HOSTS = []
29
-
26
+ SECRET_KEY = os .getenv ("SECRET_KEY" )
30
27
31
28
# Application definition
32
29
Original file line number Diff line number Diff line change 2
2
import os
3
3
from dotenv import load_dotenv
4
4
5
- # DEBUG = False
6
- # ALLOWED_HOSTS = ['mydomain.com']
5
+ DEBUG = False
6
+ ALLOWED_HOSTS = os . getenv ( "ALLOWED_HOSTS" , "" ). split ( "," )
7
7
8
8
load_dotenv ()
9
9
DATABASES = {
You can’t perform that action at this time.
0 commit comments