Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vignette
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
erdnaxe
vignette
Commits
39a0e783
Commit
39a0e783
authored
Oct 14, 2018
by
erdnaxe
🎇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate dev and prod docker
parent
e3103b1c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
23 deletions
+51
-23
README.md
README.md
+16
-5
backend/Dockerfile
backend/Dockerfile
+2
-4
docker-compose.override.yml
docker-compose.override.yml
+15
-0
docker-compose.prod.yml
docker-compose.prod.yml
+14
-0
docker-compose.yml
docker-compose.yml
+1
-13
example.env
example.env
+1
-0
frontend/Dockerfile
frontend/Dockerfile
+2
-1
No files found.
README.md
View file @
39a0e783
...
...
@@ -10,12 +10,14 @@ Vignette est séparée entre un *backend* codé avec Django Rest Framwork, et un
## Environnement de développement
Vignette utilise Docker pour simplifier la mise en route.
Pour avoir un environnement de développement, il suffit de cloner le projet et
de lancer :
Pour avoir un environnement de développement, il faut :
```
bash
docker-compose up
--build
```
-
Cloner le projet,
-
Copier example.env en .env et le configurer,
-
Lancer :
```
bash
docker-compose up
--build
```
Pour créer un super-utilisateur :
...
...
@@ -23,3 +25,12 @@ Pour créer un super-utilisateur :
docker-compose
exec
backend python manage.py createsuperuser
```
## Production
Le fichier
`production.yml`
redéfinit des paramètres pour rendre le docker
utilisable en production. Cela est encore en stade exprimental !
```
bash
docker-compose
-f
docker-compose.yml
-f
docker-compose.prod.yml up
-d
```
backend/Dockerfile
View file @
39a0e783
FROM
python:3.6-alpine
# Django code will be in /usr/src/app/
# During development you should mount the git code there,
# During production you should copy the code in the image.
# Only during development you should mount the git code there
WORKDIR
/usr/src/app
COPY
. /usr/src/app/
# Set environment variables
ENV
PYTHONDONTWRITEBYTECODE 1
ENV
PYTHONUNBUFFERED 1
# Install dependencies via pipenv
COPY
Pipfile* ./
RUN
apk update
&&
apk add gcc musl-dev postgresql-dev
RUN
pip
install
--upgrade
pip
==
18.0
RUN
pip
install
pipenv
==
2018.7.1
...
...
@@ -20,7 +19,6 @@ RUN pipenv install --deploy --system --dev
EXPOSE
8080
# Set entrypoint : make migrations and collect statics
COPY
entrypoint.sh ./
ENTRYPOINT
[ "./entrypoint.sh" ]
# Start Django app
...
...
docker-compose.override.yml
0 → 100644
View file @
39a0e783
# Only for dev
version
:
'
3'
services
:
frontend
:
volumes
:
-
./frontend:/home/node/app
-
/home/node/app/node_modules
backend
:
environment
:
# SECURITY WARNING: don't run with debug turned on in production!
-
DEBUG=0
volumes
:
-
./backend:/usr/src/app
docker-compose.prod.yml
0 → 100644
View file @
39a0e783
# Still very experimental, please be careful
version
:
'
3'
services
:
db
:
restart
:
always
frontend
:
restart
:
always
backend
:
environment
:
# SECURITY WARNING: don't run with debug turned on in production!
-
DEBUG=0
restart
:
always
docker-compose.yml
View file @
39a0e783
# Use for development purposes only
version
:
'
3'
services
:
...
...
@@ -12,33 +10,23 @@ services:
-
POSTGRES_INITDB_ARGS=--encoding=UTF-8
volumes
:
-
db_data:/var/lib/postgresql/data
restart
:
always
frontend
:
build
:
./frontend
volumes
:
-
./frontend:/home/node/app
-
/home/node/app/node_modules
ports
:
-
"
8000:3000"
restart
:
always
backend
:
build
:
./backend
environment
:
# SECURITY WARNING: keep the secret key used in production secret!
-
SECRET_KEY=changemeinprod
# SECURITY WARNING: don't run with debug turned on in production!
-
DEBUG=1
-
SECRET_KEY=${DJANGO_SECRET}
# Pass needed configuration
-
DB_NAME=${DB_NAME}
-
DB_USER=${DB_USER}
-
DB_PASSWORD=${DB_PASSWORD}
volumes
:
-
./backend:/usr/src/app
ports
:
-
"
8080:8080"
depends_on
:
-
db
restart
:
always
volumes
:
db_data
:
...
...
example.env
View file @
39a0e783
...
...
@@ -3,4 +3,5 @@
DB_NAME=vignette
DB_USER=vignette
DB_PASSWORD=changeme
DJANGO_SECRET=changemeinprod
frontend/Dockerfile
View file @
39a0e783
FROM
node:8-alpine
# Only during development you should mount the git code there
WORKDIR
/home/node/app
COPY
. /home/node/app/
# Install dependencies via npm
COPY
package* ./
RUN
npm
install
--quiet
# Start frontend
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment