Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
docker-django
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evili del Rio i Silvan
docker-django
Commits
ec305129
Commit
ec305129
authored
6 years ago
by
Evili del Rio i Silvan
Browse files
Options
Downloads
Patches
Plain Diff
Initial import
parent
6744211f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#2141
failed
6 years ago
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
.dockerignore
+2
-0
2 additions, 0 deletions
.dockerignore
Dockerfile
+20
-0
20 additions, 0 deletions
Dockerfile
README.md
+4
-0
4 additions, 0 deletions
README.md
entrypoint.sh
+26
-0
26 additions, 0 deletions
entrypoint.sh
with
52 additions
and
0 deletions
.dockerignore
0 → 100644
+
2
−
0
View file @
ec305129
Dockerfile
.dockerignore
This diff is collapsed.
Click to expand it.
Dockerfile
0 → 100644
+
20
−
0
View file @
ec305129
FROM
python:alpine
ARG
django_version=1.11
ARG
dev_packages="gcc g++ postgresql-dev"
ADD
./entrypoint.sh /
VOLUME
/static
WORKDIR
/app
RUN
apk update
&&
\
apk add bash git
\
${
dev_packages
}
&&
\
DJANGO_VERSION
=
$(
echo
${
django_version
}
|
\
awk
-F
.
'{bump=$NF+1;for(i=1;i<NF;i++){printf("%s.",$i)};printf("%s",bump)}'
)
&&
\
pip
install
"Django<=
${
DJANGO_VERSION
}
"
gunicorn
\
psycopg2-binary psycopg2 mysql-connector
\
django-heroku whitenoise[brotli]
&&
\
apk del
${
dev_packages
}
ENTRYPOINT
[ "/entrypoint.sh" ]
This diff is collapsed.
Click to expand it.
README.md
+
4
−
0
View file @
ec305129
# docker-django
A docker image to execute Django apps. It uses:
*
An environment variable GIT_URL to retrieve the project
*
django-heroku to reconfigure settings via environment variable.
This diff is collapsed.
Click to expand it.
entrypoint.sh
0 → 100755
+
26
−
0
View file @
ec305129
#!/usr/bin/env bash
printenv
set
-x
git clone
${
GIT_URL
}
.
pip
install
-r
requirements.txt
--no-input
DJANGO_SETTINGS_MODULE
=
${
DJANGO_SETTINGS_MODULE
:-
$(
basename
${
WSGI_MODULE
}
.wsgi
)
.settings
}
# Override static content
cat
>
settings.py
<<
EOF
from
${
DJANGO_SETTINGS_MODULE
}
import *
STATIC_ROOT='/static'
EOF
export
DJANGO_SETTINGS_MODULE
=
settings
python manage.py collectstatic
--no-input
python manage.py migrate
if
[
-z
"
${
WSGI_MODULE
}
"
]
then
export
WSGI_MODULE
=
$(
basename
$(
dirname
$(
find
.
-name
wsgi.py |
head
-1
)))
.wsgi
fi
gunicorn
--log-level
=
INFO
${
WSGI_MODULE
}
$*
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment