Skip to content

Commit a183ccf

Browse files
authored
Fix/docker variables (#201)
Updated docker to use some variables
1 parent 91a09e3 commit a183ccf

File tree

7 files changed

+51
-26
lines changed

7 files changed

+51
-26
lines changed

.github/workflows/run_tests.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ jobs:
5959
# run docker compose & tests
6060
#----------------------------------------------
6161
- name: Build and run docker-compose.ci.yml
62-
run: docker compose up -d --wait --wait-timeout 30
62+
run: |
63+
export TESTING=true
64+
docker compose up -d --wait --wait-timeout 30
6365
6466
- name: Run the test scripts
6567
run: |
68+
export TESTING=true
6669
docker compose exec -T myfinances_django ./infrastructure/backend/scripts/tests/views.sh

infrastructure/backend/Dockerfile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,34 @@ WORKDIR /MyFinances
1111

1212
COPY . .
1313

14-
RUN apk --no-cache --update add \
15-
mariadb-connector-c-dev \
16-
py-pip \
17-
musl-dev \
18-
gcc \
19-
mariadb-dev \
20-
libffi-dev
21-
22-
RUN poetry install --without dev,mysql --no-root && rm -rf $POETRY_CACHE_DIR
14+
#RUN #apk --no-cache --update add \
15+
# mariadb-connector-c-dev \
16+
# py-pip \
17+
# musl-dev \
18+
# gcc \
19+
# mariadb-dev \
20+
# libffi-dev
21+
22+
23+
# Install build dependencies
24+
RUN apk add --no-cache --virtual .build-deps py-pip musl-dev gcc
25+
26+
# Install MySQL dependencies and packages if DATABASE_TYPE is mysql
27+
RUN if [ "${DATABASE_TYPE}" = "mysql" ]; then \
28+
apk add --no-cache mariadb-dev && \
29+
poetry install --only mysql; \
30+
fi
31+
32+
# Install PostgreSQL dependencies and packages if TESTING is not true or DATABASE_TYPE is postgres
33+
RUN if [ "${TESTING}" != "true" ] || [ "${DATABASE_TYPE}" = "postgres" ]; then \
34+
apk add --no-cache postgresql-dev && \
35+
poetry install --only postgres; \
36+
fi
37+
38+
# Clean up build dependencies
39+
RUN apk del .build-deps
40+
41+
RUN poetry install --without dev,mysql,postgres --no-root && rm -rf $POETRY_CACHE_DIR
2342

2443
RUN chmod +x infrastructure/backend/scripts/*
2544
RUN chmod +x infrastructure/backend/scripts/tests/*

infrastructure/backend/docker-compose.ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ services:
1616
PROXY_IP: "localhost"
1717
BRANCH: "debug"
1818
DEBUG: "true"
19-
DATABASE_TYPE: "sqlite3"
19+
DATABASE_TYPE: "sqlite3"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "myfinances",
3-
"version": "0.1.2",
3+
"version": "0.2.1",
44
"description": "",
55
"main": "index.js",
66
"scripts": {

poetry.lock

Lines changed: 9 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "MyFinances"
3-
version = "0.1.1"
3+
version = "0.2.1"
44
description = "github.com/TreyWW/MyFinances"
55
authors = []
66
readme = "README.md"

settings/prod_settings.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@
3232
"HOST": os.environ.get("DATABASE_HOST") or "localhost",
3333
"PORT": os.environ.get("DATABASE_PORT")
3434
or (3306 if DB_TYPE == "mysql" else 5432),
35-
"OPTIONS": {
36-
"sql_mode": "traditional",
37-
},
35+
"OPTIONS": (
36+
{
37+
"sql_mode": "traditional",
38+
}
39+
if DB_TYPE == "mysql"
40+
else {}
41+
),
3842
}
3943
}
4044

0 commit comments

Comments
 (0)