Skip to content

Commit

Permalink
add docker
Browse files Browse the repository at this point in the history
  • Loading branch information
xopino committed May 4, 2024
1 parent b165524 commit c3ac8ef
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Created by https://www.gitignore.io

### OSX ###
.DS_Store
.AppleDouble
Expand Down Expand Up @@ -88,3 +87,4 @@ local_settings.py
.env
db.sqlite3

.idea
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:20.04

RUN apt-get update && \
apt-get install -y python3.8 python3-pip && \
pip install pipenv

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 && \
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1

COPY . /app

WORKDIR /app

RUN pipenv install --deploy --ignore-pipfile

EXPOSE 8000

CMD ["pipenv", "run", "python", "manage.py", "runserver", "0.0.0.0:8000"]
17 changes: 17 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
IMAGE_NAME=shopify_django_app

build:
docker build -t $(IMAGE_NAME) .

run:
docker run -d --name $(IMAGE_NAME) -v $(PWD):/app -p 8000:8000 $(IMAGE_NAME)

stop:
docker stop $(IMAGE_NAME)
docker rm $(IMAGE_NAME)

shell:
docker run -it $(IMAGE_NAME) /bin/bash

migration:
docker run -it -v $(PWD):/app $(IMAGE_NAME) pipenv run python manage.py migrate
5 changes: 4 additions & 1 deletion shopify_django_app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []
ALLOWED_HOSTS = [
'localhost',
'127.0.0.1',
]

# Application definition

Expand Down

0 comments on commit c3ac8ef

Please sign in to comment.