Skip to content

Commit

Permalink
Merge pull request #87 from EyeSeeTea/development
Browse files Browse the repository at this point in the history
Release 1.6.0
  • Loading branch information
ifoche authored Apr 4, 2022
2 parents 702ac5c + 4bccc25 commit 4c6c07f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setuptools.setup(
name="d2_docker",
version="1.5.0",
version="1.6.0",
description="Dockers for DHIS2 instances",
long_description=open("README.md", encoding="utf-8").read(),
keywords=["python"],
Expand Down
2 changes: 2 additions & 0 deletions src/d2_docker/commands/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def setup(parser):
)
parser.add_argument("--pull", action="store_true", help="Force a pull from docker hub")
parser.add_argument("-p", "--port", type=int, metavar="N", help="Set Dhis2 instance port")
parser.add_argument("--bind-ip", type=str, metavar="IP", help="Bind Dhis2 instance to IP")
parser.add_argument("--deploy-path", type=str, help="Set Tomcat context.path")
parser.add_argument("--java-opts", type=str, help="Set Tomcat JAVA_OPTS")
parser.add_argument("--postgis-version", type=str, help="Set PostGIS database version")
Expand Down Expand Up @@ -92,6 +93,7 @@ def start(args, image_name):
["up", *up_args],
image_name,
port=port,
bind_ip=args.bind_ip,
core_image=core_image,
load_from_data=override_containers,
post_sql_dir=args.run_sql,
Expand Down
2 changes: 1 addition & 1 deletion src/d2_docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ services:
- "com.eyeseetea.image-name=${DHIS2_DATA_IMAGE}"
- "com.eyeseetea.deploy-path=${DEPLOY_PATH}"
ports:
- "${DHIS2_CORE_PORT:-8080}:80"
- "${DHIS2_CORE_IP:-}${DHIS2_CORE_PORT:-8080}:80"
volumes:
- ./config/nginx.conf:/etc/nginx/nginx.conf:ro
- ./config/50x.html:/usr/share/nginx/html/50x.html:ro
Expand Down
3 changes: 1 addition & 2 deletions src/d2_docker/images/dhis2-core/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ RUN rm -rf /usr/local/tomcat/webapps/* && \
addgroup root tomcat && \
adduser -S -D -G tomcat tomcat

RUN apk add --update --no-cache bash su-exec curl postgresql-client
RUN apk add --update --no-cache bash su-exec curl postgresql-client fontconfig ttf-dejavu

COPY dhis.war /usr/local/tomcat/webapps/ROOT.war
COPY dhis2-home-files /dhis2-home-files


ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

CMD ["catalina.sh", "run"]
6 changes: 4 additions & 2 deletions src/d2_docker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ def get_image_status(image_name):


def get_port_from_docker_ports(info):
port_re = r"0\.0\.0\.0:(\d+)->80"
match = re.match(port_re, info)
port_re = r":(\d+)->80/tcp"
match = re.search(port_re, info)
port = int(match.group(1)) if match else None
return port

Expand Down Expand Up @@ -225,6 +225,7 @@ def run_docker_compose(
load_from_data=True,
post_sql_dir=None,
db_port=None,
bind_ip=None,
scripts_dir=None,
deploy_path=None,
dhis_conf=None,
Expand All @@ -250,6 +251,7 @@ def run_docker_compose(
env_pairs = [
("DHIS2_DATA_IMAGE", final_image_name),
("DHIS2_CORE_PORT", str(port)) if port else None,
("DHIS2_CORE_IP", bind_ip + ":") if bind_ip else "",
("DHIS2_CORE_IMAGE", core_image_name),
("LOAD_FROM_DATA", "yes" if load_from_data else "no"),
# Set default values for directory, required by docker-compose volumes section
Expand Down

0 comments on commit 4c6c07f

Please sign in to comment.