Skip to content

Commit

Permalink
Created Docker Image for version 1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonski committed Mar 4, 2020
1 parent 1d18c2d commit 8752a32
Show file tree
Hide file tree
Showing 8 changed files with 682 additions and 12 deletions.
70 changes: 70 additions & 0 deletions 1.3.3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Use an official Python runtime as a parent image
FROM python:2.7-stretch

# Set one or more individual labels
LABEL maintainer="Ramon Bartl"
LABEL email="rb@ridingbytes.com"
LABEL senaite.core.version="1.3.3"

# Set environment variables
ENV PLONE_MAJOR=4.3 \
PLONE_VERSION=4.3.19 \
PLONE_MD5=04ed5beac7fb8504f06a36d44e407b06 \
SENAITE_HOME=/home/senaite \
SENAITE_USER=senaite \
SENAITE_INSTANCE_HOME=/home/senaite/senaitelims \
SENAITE_DATA=/data \
SENAITE_FILESTORAGE=/data/filestorage \
SENAITE_BLOBSTORAGE=/data/blobstorage

# Create the senaite user
RUN useradd --system -m -d $SENAITE_HOME -U -u 500 $SENAITE_USER

# Create direcotries
RUN mkdir -p $SENAITE_INSTANCE_HOME $SENAITE_FILESTORAGE $SENAITE_BLOBSTORAGE

# Copy the package config
COPY packages.txt /

# Install package dependencies
RUN apt-get update && apt-get install -y --no-install-recommends $(grep -vE "^\s*#" /packages.txt | tr "\n" " ")

# Fetch unified installer
RUN wget -O Plone.tgz https://launchpad.net/plone/$PLONE_MAJOR/$PLONE_VERSION/+download/Plone-$PLONE_VERSION-UnifiedInstaller.tgz \
&& echo "$PLONE_MD5 Plone.tgz" | md5sum -c - \
&& tar -xzf Plone.tgz \
&& cp -rv /Plone-$PLONE_VERSION-UnifiedInstaller/base_skeleton/* $SENAITE_INSTANCE_HOME \
&& cp -v /Plone-$PLONE_VERSION-UnifiedInstaller/buildout_templates/buildout.cfg $SENAITE_INSTANCE_HOME/buildout-base.cfg \
&& cd $SENAITE_HOME \
&& tar -xjf /Plone-$PLONE_VERSION-UnifiedInstaller/packages/buildout-cache.tar.bz2 \
&& rm -rf /Plone-$PLONE_VERSION-UnifiedInstaller /Plone.tgz

# Change working directory
WORKDIR $SENAITE_INSTANCE_HOME

# Copy Buildout
COPY bootstrap.py buildout.cfg ./

# Bootstrap and buildout
RUN python bootstrap.py \
&& bin/buildout \
&& ln -s $SENAITE_FILESTORAGE/ var/filestorage \
&& ln -s $SENAITE_BLOBSTORAGE/ var/blobstorage \
&& chown -R senaite:senaite $SENAITE_HOME $SENAITE_DATA \
&& rm -rf $SENAITE_HOME/buildout-cache/downloads/dist

# Mount external volume
VOLUME /data

# Copy startup scripts
COPY docker-initialize.py docker-entrypoint.sh /

# Expose instance port
EXPOSE 8080

# Add instance healthcheck
HEALTHCHECK --interval=1m --timeout=5s --start-period=1m \
CMD nc -z -w5 127.0.0.1 8080 || exit 1

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["start"]
210 changes: 210 additions & 0 deletions 1.3.3/bootstrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Bootstrap a buildout-based project
Simply run this script in a directory containing a buildout.cfg.
The script accepts buildout command-line options, so you can
use the -c option to specify an alternate configuration file.
"""

import os
import shutil
import sys
import tempfile

from optparse import OptionParser

__version__ = '2015-07-01'
# See zc.buildout's changelog if this version is up to date.

tmpeggs = tempfile.mkdtemp(prefix='bootstrap-')

usage = '''\
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
Bootstraps a buildout-based project.
Simply run this script in a directory containing a buildout.cfg, using the
Python that you want bin/buildout to use.
Note that by using --find-links to point to local resources, you can keep
this script from going over the network.
'''

parser = OptionParser(usage=usage)
parser.add_option("--version",
action="store_true", default=False,
help=("Return bootstrap.py version."))
parser.add_option("-t", "--accept-buildout-test-releases",
dest='accept_buildout_test_releases',
action="store_true", default=False,
help=("Normally, if you do not specify a --version, the "
"bootstrap script and buildout gets the newest "
"*final* versions of zc.buildout and its recipes and "
"extensions for you. If you use this flag, "
"bootstrap and buildout will get the newest releases "
"even if they are alphas or betas."))
parser.add_option("-c", "--config-file",
help=("Specify the path to the buildout configuration "
"file to be used."))
parser.add_option("-f", "--find-links",
help=("Specify a URL to search for buildout releases"))
parser.add_option("--allow-site-packages",
action="store_true", default=False,
help=("Let bootstrap.py use existing site packages"))
parser.add_option("--buildout-version",
help="Use a specific zc.buildout version")
parser.add_option("--setuptools-version",
help="Use a specific setuptools version")
parser.add_option("--setuptools-to-dir",
help=("Allow for re-use of existing directory of "
"setuptools versions"))

options, args = parser.parse_args()
if options.version:
print("bootstrap.py version %s" % __version__)
sys.exit(0)


######################################################################
# load/install setuptools

try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen

ez = {}
if os.path.exists('ez_setup.py'):
exec(open('ez_setup.py').read(), ez)
else:
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)

if not options.allow_site_packages:
# ez_setup imports site, which adds site packages
# this will remove them from the path to ensure that incompatible versions
# of setuptools are not in the path
import site
# inside a virtualenv, there is no 'getsitepackages'.
# We can't remove these reliably
if hasattr(site, 'getsitepackages'):
for sitepackage_path in site.getsitepackages():
# Strip all site-packages directories from sys.path that
# are not sys.prefix; this is because on Windows
# sys.prefix is a site-package directory.
if sitepackage_path != sys.prefix:
sys.path[:] = [x for x in sys.path
if sitepackage_path not in x]

setup_args = dict(to_dir=tmpeggs, download_delay=0)

if options.setuptools_version is not None:
setup_args['version'] = options.setuptools_version
if options.setuptools_to_dir is not None:
setup_args['to_dir'] = options.setuptools_to_dir

ez['use_setuptools'](**setup_args)
import setuptools
import pkg_resources

# This does not (always?) update the default working set. We will
# do it.
for path in sys.path:
if path not in pkg_resources.working_set.entries:
pkg_resources.working_set.add_entry(path)

######################################################################
# Install buildout

ws = pkg_resources.working_set

setuptools_path = ws.find(
pkg_resources.Requirement.parse('setuptools')).location

# Fix sys.path here as easy_install.pth added before PYTHONPATH
cmd = [sys.executable, '-c',
'import sys; sys.path[0:0] = [%r]; ' % setuptools_path +
'from setuptools.command.easy_install import main; main()',
'-mZqNxd', tmpeggs]

find_links = os.environ.get(
'bootstrap-testing-find-links',
options.find_links or
('http://downloads.buildout.org/'
if options.accept_buildout_test_releases else None)
)
if find_links:
cmd.extend(['-f', find_links])

requirement = 'zc.buildout'
version = options.buildout_version
if version is None and not options.accept_buildout_test_releases:
# Figure out the most recent final version of zc.buildout.
import setuptools.package_index
_final_parts = '*final-', '*final'

def _final_version(parsed_version):
try:
return not parsed_version.is_prerelease
except AttributeError:
# Older setuptools
for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts):
return False
return True

index = setuptools.package_index.PackageIndex(
search_path=[setuptools_path])
if find_links:
index.add_find_links((find_links,))
req = pkg_resources.Requirement.parse(requirement)
if index.obtain(req) is not None:
best = []
bestv = None
for dist in index[req.project_name]:
distv = dist.parsed_version
if _final_version(distv):
if bestv is None or distv > bestv:
best = [dist]
bestv = distv
elif distv == bestv:
best.append(dist)
if best:
best.sort()
version = best[-1].version
if version:
requirement = '=='.join((requirement, version))
cmd.append(requirement)

import subprocess
if subprocess.call(cmd) != 0:
raise Exception(
"Failed to execute command:\n%s" % repr(cmd)[1:-1])

######################################################################
# Import and run buildout

ws.add_entry(tmpeggs)
ws.require(requirement)
import zc.buildout.buildout

if not [a for a in args if '=' not in a]:
args.append('bootstrap')

# if -c was provided, we push it back into args for buildout' main function
if options.config_file is not None:
args[0:0] = ['-c', options.config_file]

zc.buildout.buildout.main(args)
shutil.rmtree(tmpeggs)
111 changes: 111 additions & 0 deletions 1.3.3/buildout.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
[buildout]
extends =
buildout-base.cfg

extensions =

index = https://pypi.python.org/simple/

var-dir=/data
user=admin:admin

effective-user = senaite
buildout-user = senaite

eggs-directory=../buildout-cache/eggs
download-cache=../buildout-cache/downloads

parts +=
zeo

eggs +=
senaite.lims

[client1]
recipe =

[zeo]
<= zeoserver_base
recipe = plone.recipe.zeoserver
zeo-address = 8080

[versions]
setuptools=
zc.buildout=
senaite.lims=1.3.3
soupsieve = 1.9.4

# The following part definition lists the versions picked:
Chameleon = 3.6.2
Products.ATExtensions = 1.1
Pyphen = 0.9.5
Werkzeug = 1.0.0
backports.functools-lru-cache = 1.6.1
cairocffi = 0.9.0
cffi = 1.14.0
cssselect2 = 0.2.2
html5lib = 1.0.1
more-itertools = 5.0.0
pdfrw = 0.4
plone.recipe.command = 1.1
plone.recipe.precompiler = 0.6
senaite.core.supermodel = 1.2.3
sourcecodegen = 0.6.14
tinycss2 = 0.6.1
webencodings = 0.5.1
z3c.pt = 3.2.0

# Required by:
# senaite.core==1.3.3
Products.DataGridField = 1.9.6

# Required by:
# senaite.core==1.3.3
Products.TextIndexNG3 = 3.4.14

# Required by:
# senaite.impress==1.2.3
beautifulsoup4 = 4.8.2

# Required by:
# senaite.core==1.3.3
collective.indexing = 2.1

# Required by:
# senaite.core==1.3.3
collective.progressbar = 0.5

# Required by:
# plone.jsonapi.core==0.6
dicttoxml = 1.7.4

# Required by:
# senaite.core==1.3.3
jarn.jsi18n = 1.1

# Required by:
# senaite.core==1.3.3
magnitude = 0.9.4

# Required by:
# senaite.core==1.3.3
plone.jsonapi.core = 0.6

# Required by:
# cffi==1.14.0
pycparser = 2.19

# Required by:
# senaite.core==1.3.3
z3c.jbot = 0.8

# Required by:
# plone.recipe.unifiedinstaller==4.3.2
# plone.recipe.zeoserver==1.3.1
# plone.recipe.zope2instance==4.4.1
# z3c.autoinclude==0.3.9
zc.buildout = 2.13.3

# Required by:
# Products.TextIndexNG3==3.4.14
zopyx.txng3.core = 3.6.2
Loading

0 comments on commit 8752a32

Please sign in to comment.