Skip to content

Commit

Permalink
Update the dockerfile to work for the prod config
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei committed Dec 27, 2023
1 parent 6c0c770 commit 0fa1560
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ upd-sqlite: ## run the project with sqlite in detached mod
docker compose --profile sqlite3 up -d --build

up-mysql: ## run the project with mysql
docker compose --profile mysql up --build
docker compose --profile mysql up --build``

upd-mysql: ## run the project with mysql in detached mode
docker compose --profile mysql up -d --build
Expand Down
20 changes: 20 additions & 0 deletions backend/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ frozenlist==1.4.1
# via
# aiohttp
# aiosignal
gevent==23.9.1
# via -r requirements.txt
greenlet==3.0.3
# via
# -r requirements.txt
# gevent
gunicorn==21.2.0
# via -r requirements.txt
idna==3.6
# via yarl
jinja2==3.1.2
Expand All @@ -69,8 +77,10 @@ mypy-extensions==1.0.0
# via black
packaging==23.2
# via
# -r requirements.txt
# black
# build
# gunicorn
pathspec==0.12.1
# via black
pip-tools==7.3.0
Expand Down Expand Up @@ -124,8 +134,18 @@ wcwidth==0.2.12
# blessed
wheel==0.42.0
# via pip-tools
whitenoise==6.6.0
# via -r requirements.txt
yarl==1.9.4
# via aiohttp
zope-event==5.0
# via
# -r requirements.txt
# gevent
zope-interface==6.1
# via
# -r requirements.txt
# gevent

# The following packages are considered to be unsafe in a requirements file:
# pip
Expand Down
7 changes: 7 additions & 0 deletions backend/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,10 @@ jinja2~=3.1.2

# GeoIP support
python-geoip-geolite2==2015.303

# web server
gevent~=23.9.1
gunicorn~=21.2.0

# file storage
whitenoise~=6.6.0
17 changes: 17 additions & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,18 @@ django-picklefield==3.1
# via django-q2
django-q2==1.6.1
# via -r requirements.in
gevent==23.9.1
# via -r requirements.in
greenlet==3.0.3
# via gevent
gunicorn==21.2.0
# via -r requirements.in
jinja2==3.1.2
# via -r requirements.in
markupsafe==2.1.3
# via jinja2
packaging==23.2
# via gunicorn
psutil==5.9.7
# via -r requirements.in
pycparser==2.21
Expand Down Expand Up @@ -60,3 +68,12 @@ urllib3==2.1.0
# via sentry-sdk
wcwidth==0.2.12
# via blessed
whitenoise==6.6.0
# via -r requirements.in
zope-event==5.0
# via gevent
zope-interface==6.1
# via gevent

# The following packages are considered to be unsafe in a requirements file:
# setuptools
12 changes: 6 additions & 6 deletions docker/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
FROM node:18.17.1-bookworm-slim as frontend

WORKDIR /var/www/redirect/frontend

COPY ./frontend/ .
WORKDIR /var/www/redirect/build
COPY ./backend/ .

# install the frontend libraries:
RUN npm ci --no-audit --ignore-scripts && \
npm run prod
RUN npm install -g npm bower && \
bower install --allow-root --config.interactive=false

FROM python:3.11.7-slim-bookworm as backend

Expand All @@ -25,6 +24,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"

WORKDIR /build
COPY ./backend/requirements.txt .

RUN python3 -m pip install --upgrade pip setuptools && \
python3 -m pip install -r ./requirements.txt

Expand Down Expand Up @@ -74,7 +74,7 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
COPY --from=backend "${VIRTUAL_ENV}" "${VIRTUAL_ENV}"
COPY ./backend/ /var/www/redirect/backend/

COPY --from=frontend /var/www/redirect/frontend/dist/ /var/www/redirect/frontend/dist/
COPY --from=frontend /var/www/redirect/build/bower_components/ /var/www/redirect/backend/bower_components/

# activate the virtualenv:
RUN . "${VIRTUAL_ENV}/bin/activate"
Expand Down

0 comments on commit 0fa1560

Please sign in to comment.