Skip to content

Commit de1b76b

Browse files
committed
Fix the docker images so they start ready to go. Closes #58
Squashed commit of the following: commit a9a6e11 Author: crccheck <[email protected]> Date: Thu Feb 25 18:06:45 2016 -0600 doc the Dock commit acaae61 Author: crccheck <[email protected]> Date: Thu Feb 25 17:53:04 2016 -0600 switch to smaller base image and cacheable layers commit 0fc7114 Author: crccheck <[email protected]> Date: Thu Feb 25 17:46:37 2016 -0600 doc how to upload images commit 01fa295 Author: crccheck <[email protected]> Date: Thu Feb 25 17:27:36 2016 -0600 ugh commit dc35498 Author: crccheck <[email protected]> Date: Thu Feb 25 17:24:27 2016 -0600 create a default admin/admin user commit 8a49250 Author: crccheck <[email protected]> Date: Thu Feb 25 17:10:12 2016 -0600 fix how the docker images didn't have a database
1 parent 98aad50 commit de1b76b

File tree

5 files changed

+84
-9
lines changed

5 files changed

+84
-9
lines changed

Dockerfile

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1-
FROM python:2-onbuild
1+
FROM python:2.7-alpine
2+
3+
RUN apk add --no-cache make
4+
5+
ADD requirements.txt /app/requirements.txt
6+
RUN pip --disable-pip-version-check install -r /app/requirements.txt
27

38
ARG DJANGO_VERSION
9+
RUN pip --disable-pip-version-check install django==$DJANGO_VERSION
410

5-
RUN pip install django==$DJANGO_VERSION
11+
ADD . /app
12+
WORKDIR /app
13+
ENV PYTHONPATH /app
14+
15+
RUN make resetdb
16+
RUN echo "from django.contrib.auth import get_user_model; \
17+
User = get_user_model(); \
18+
User.objects.create_superuser('admin', '[email protected]', 'admin')" | \
19+
python example_project/manage.py shell
620

721
ENV PORT 8000
822
EXPOSE 8000
923

10-
ENV PYTHONPATH /usr/src/app
11-
1224
CMD python example_project/manage.py runserver 0.0.0.0:$PORT

Makefile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ coverage: ## Run and then display coverage report
3636

3737
resetdb: ## Delete and then recreate the dev sqlite database
3838
python $(MANAGE) reset_db --router=default --noinput
39-
python $(MANAGE) syncdb --noinput
40-
python $(MANAGE) migrate --noinput
39+
-python $(MANAGE) syncdb --noinput
40+
-python $(MANAGE) migrate --noinput
4141
python $(MANAGE) loaddata sample_data
4242

4343
.PHONY: build
4444
build: ## Build a full set of Docker images
45-
build: build/1.9 build/1.8.7 build/1.7.11 build/1.6.11 build/1.5.12
45+
build: build/1.9.2 build/1.8.9 build/1.7.11 build/1.6.11 build/1.5.12
4646

4747
build/%:
4848
docker build --build-arg DJANGO_VERSION=$* \
@@ -51,10 +51,17 @@ build/%:
5151
run: run/1.9
5252

5353
run/%:
54-
docker run --rm -p 8000:8000 --sig-proxy=false $(IMAGE):$*
54+
docker run --rm -p 8000:8000 -it $(IMAGE):$*
55+
56+
docker/publish: ## Publish Docker images to the hub
57+
docker push $(IMAGE):1.9
58+
docker push $(IMAGE):1.8
59+
docker push $(IMAGE):1.7
60+
docker push $(IMAGE):1.6
61+
docker push $(IMAGE):1.5
5562

5663
test/%:
57-
docker run --rm -p 8000:8000 --sig-proxy=false $(IMAGE):$* make test
64+
docker run --rm -p 8000:8000 -t $(IMAGE):$* make test
5865

5966
bash:
6067
docker run --rm -it $(IMAGE):1.9 /bin/bash

README.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,16 @@ Limitations
172172
planned for the future.
173173

174174

175+
Demo Admin & Docker images
176+
--------------------------
177+
178+
You can try the demo admin against several versions of Django with these Docker
179+
images: https://hub.docker.com/r/crccheck/django-object-actions/
180+
181+
This runs the example Django project in ``./example_project`` based on the
182+
"polls" tutorial. ``admin.py`` demos what you can do with this app.
183+
184+
175185
Development
176186
-----------
177187

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# -*- coding: utf-8 -*-
2+
# Generated by Django 1.9.2 on 2016-02-25 17:25
3+
from __future__ import unicode_literals
4+
5+
from django.db import migrations, models
6+
import django.db.models.deletion
7+
import django_extensions.db.fields
8+
9+
10+
class Migration(migrations.Migration):
11+
12+
initial = True
13+
14+
dependencies = [
15+
]
16+
17+
operations = [
18+
migrations.CreateModel(
19+
name='Choice',
20+
fields=[
21+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22+
('choice_text', models.CharField(max_length=200)),
23+
('votes', models.IntegerField()),
24+
],
25+
),
26+
migrations.CreateModel(
27+
name='Comment',
28+
fields=[
29+
('uuid', django_extensions.db.fields.UUIDField(blank=True, editable=False, primary_key=True, serialize=False)),
30+
('comment', models.TextField(blank=True, null=True)),
31+
],
32+
),
33+
migrations.CreateModel(
34+
name='Poll',
35+
fields=[
36+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
37+
('question', models.CharField(max_length=200)),
38+
('pub_date', models.DateTimeField(verbose_name=b'date published')),
39+
],
40+
),
41+
migrations.AddField(
42+
model_name='choice',
43+
name='poll',
44+
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='polls.Poll'),
45+
),
46+
]

example_project/polls/migrations/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)