Skip to content

Instantly share code, notes, and snippets.

@BertrandBordage
Created January 30, 2015 14:44
Show Gist options
  • Save BertrandBordage/03347673ea3e598bebd2 to your computer and use it in GitHub Desktop.
Save BertrandBordage/03347673ea3e598bebd2 to your computer and use it in GitHub Desktop.
Wagtail demo Dockerfile
# Build this docker image using: docker build -t wagtail-demo [path_to_the_folder_containing_this_file]
# Run it using: docker run -p 8000:8000 wagtail-demo
FROM ubuntu:14.10
MAINTAINER Bertrand Bordage, [email protected]
RUN apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install postgresql postgresql-server-dev-9.4 build-essential \
python2.7 python-pip python-dev python-opencv python-numpy \
&& apt-get -y build-dep pillow \
&& apt-get clean \
&& apt-get -y autoremove
ADD https://github.com/torchbox/wagtaildemo/archive/master.tar.gz /
RUN tar -xvf /master.tar.gz -C / && rm /master.tar.gz
WORKDIR /wagtaildemo-master/
RUN pip install -r requirements.txt
# Uncomment if you want the latest wagtail version
# RUN pip install https://github.com/torchbox/wagtail/archive/master.tar.gz
RUN sed -i 's/# Database administrative login by Unix domain socket/&\nlocal all postgres trust/' /etc/postgresql/9.4/main/pg_hba.conf
RUN service postgresql start \
&& psql -U postgres -c 'CREATE DATABASE wagtaildemo;' \
&& python manage.py migrate \
&& python manage.py load_initial_data
RUN echo 'WAGTAILIMAGES_FEATURE_DETECTION_ENABLED = True' >> wagtaildemo/settings/base.py
# Change your language code using this
# RUN sed -i "s/LANGUAGE_CODE = 'en-gb'/LANGUAGE_CODE = 'fr'/" wagtaildemo/settings/base.py
CMD service postgresql start && python manage.py runserver 0.0.0.0:8000
EXPOSE 8000
@martinkrung
Copy link

Did not run on ubuntu with Docker version 1.6.2, Postgres Version 9.4 Error:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/migrate.py", line 63, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/executor.py", line 17, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/loader.py", line 48, in __init__
    self.build_graph()
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/loader.py", line 183, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/recorder.py", line 59, in applied_migrations
    self.ensure_schema()
  File "/usr/local/lib/python2.7/dist-packages/django/db/migrations/recorder.py", line 49, in ensure_schema
    if self.Migration._meta.db_table in self.connection.introspection.get_table_list(self.connection.cursor()):
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 165, in cursor
    cursor = self.make_debug_cursor(self._cursor())
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 138, in _cursor
    self.ensure_connection()
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 133, in ensure_connection
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/django/db/utils.py", line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 133, in ensure_connection
    self.connect()
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/__init__.py", line 122, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py", line 130, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/usr/local/lib/python2.7/dist-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
django.db.utils.OperationalError: FATAL:  role "root" does not exist

@martinkrung
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment