Skip to content

Commit

Permalink
Fixed Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
tchellomello committed Mar 13, 2018
1 parent 7011880 commit 5af4ea4
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 17 deletions.
12 changes: 12 additions & 0 deletions .bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
source /home/django-app/.virtualenv/bin/activate
41 changes: 29 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
FROM fedora
MAINTAINER http://fedoraproject.org/wiki/Cloud
FROM fedora:27
MAINTAINER Marcelo Moreira de Mello <[email protected]>

ENV PORT 8000

# create django-app user
RUN useradd django-app

# update and install dependencies
RUN dnf clean all && \
dnf -y update && \
dnf -y install python3 python3-devel python3-pip git \
python3-virtualenv sqlite python-psycopg2 \
openssl-devel && dnf clean all
python3-virtualenv sqlite openssl-devel && \
dnf clean all


# create directory and mount sources there
ADD start.sh requirements.txt mysslcerts /home/django-app/code/
RUN chmod +x /home/django-app/code/start.sh
ADD .bashrc /home/django-app/
RUN chown django-app:django-app -R /home/django-app

# set user
USER django-app
RUN /usr/bin/py3-virtualenv -p python3.6 /home/django-app/.virtualenv

COPY mysslcerts /code
RUN pip install -r /code/mysslcerts/requirements.txt
# set workdir
WORKDIR /home/django-app/code

# create directory /code and mount sources there
RUN mkdir /code
WORKDIR /code
VOLUME /code
# export volume
VOLUME /home/django-app/code

EXPOSE 8000
# expose 8000 port
EXPOSE ${PORT}

CMD python mysslcerts/manage.py runserver 0.0.0.0:8000
# define command to start container
ENTRYPOINT ["/bin/bash", "/home/django-app/code/start.sh"]
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# my-ssl-certs
Simple based Django application to request and sign custom SSL certificates


### Credentials:
admin: **mysslcerts**

### Docker
docker run -p 8000:8000 tchellomello/mysslcerts:latest
6 changes: 2 additions & 4 deletions mysslcerts/mysslcerts/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

## add the desired hosts here
## modify the desired hosts here
ALLOWED_HOSTS = [
'localhost',
'127.0.0.1',
#'*',
'*',
]


Expand Down
9 changes: 9 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

PATH="/usr/bin:/usr/sbin"

source /home/django-app/.virtualenv/bin/activate

pip install -r /home/django-app/code/requirements.txt

/home/django-app/code/manage.py runserver 0.0.0.0:${PORT}

0 comments on commit 5af4ea4

Please sign in to comment.