Skip to content

Commit 477a4de

Browse files
author
Henry Walshaw
committed
Dockerfile cleanup and compose creation
Also includes adding requirements for lsp to make autocompletion easier.
1 parent 9af0d86 commit 477a4de

File tree

3 files changed

+106
-65
lines changed

3 files changed

+106
-65
lines changed

Dockerfile

Lines changed: 81 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
FROM ubuntu:jammy
1+
FROM ubuntu:jammy AS base
22

33
# Credits to yjacolin for providing first versions
44
LABEL original_developer="yjacolin <[email protected]>" \
5-
maintainer="Just van den Broecke <[email protected]>"
5+
maintainer="Just van den Broecke <[email protected]>"
66

77
# These are default values,
88
# Override when running container via docker(-compose)
@@ -13,65 +13,67 @@ ARG LANG="en_US.UTF-8"
1313
ARG ADD_DEB_PACKAGES=""
1414

1515
# General ENV settings
16-
ENV LC_ALL="en_US.UTF-8" \
17-
LANG="en_US.UTF-8" \
18-
LANGUAGE="en_US.UTF-8" \
19-
\
20-
\
21-
DEB_PACKAGES="locales gunicorn postgresql-client python3-gunicorn python3-gevent python3-psycopg2 python3-lxml python3-pyproj" \
22-
DEB_BUILD_DEPS="make python3-pip" \
23-
# GHC ENV settings\
24-
ADMIN_NAME=admin \
25-
ADMIN_PWD=admin \
26-
27-
SQLALCHEMY_DATABASE_URI='sqlite:////GeoHealthCheck/DB/data.db' \
28-
SQLALCHEMY_ENGINE_OPTION_PRE_PING=False \
29-
SECRET_KEY='d544ccc37dc3ad214c09b1b7faaa64c60351d5c8bb48b342' \
30-
GHC_PROBE_HTTP_TIMEOUT_SECS=30 \
31-
GHC_MINIMAL_RUN_FREQUENCY_MINS=10 \
32-
GHC_RETENTION_DAYS=30 \
33-
GHC_SELF_REGISTER=False \
34-
GHC_NOTIFICATIONS=False \
35-
GHC_NOTIFICATIONS_VERBOSITY=True \
36-
GHC_WWW_LINK_EXCEPTION_CHECK=False \
37-
GHC_LARGE_XML=False \
38-
GHC_ADMIN_EMAIL='[email protected]' \
39-
GHC_RUNNER_IN_WEBAPP=False \
40-
GHC_REQUIRE_WEBAPP_AUTH=False \
41-
GHC_BASIC_AUTH_DISABLED=False \
42-
GHC_VERIFY_SSL=True \
43-
GHC_LOG_LEVEL=30 \
44-
GHC_LOG_FORMAT='%(asctime)s - %(name)s - %(levelname)s - %(message)s' \
45-
GHC_NOTIFICATIONS_EMAIL='[email protected],[email protected]' \
46-
GHC_SITE_TITLE='GeoHealthCheck' \
47-
GHC_SITE_URL='http://localhost' \
48-
GHC_SMTP_SERVER=None \
49-
GHC_SMTP_PORT=None \
50-
GHC_SMTP_TLS=False \
51-
GHC_SMTP_SSL=False \
52-
GHC_SMTP_USERNAME=None \
53-
GHC_SMTP_PASSWORD=None \
54-
GHC_GEOIP_URL='http://ip-api.com/json/{hostname}' \
55-
GHC_GEOIP_LATFIELD='lat' \
56-
GHC_GEOIP_LONFIELD='lon' \
57-
GHC_METADATA_CACHE_SECS=900 \
58-
\
59-
# WSGI server settings, assumed is gunicorn \
60-
HOST=0.0.0.0 \
61-
PORT=80 \
62-
WSGI_WORKERS=4 \
63-
WSGI_WORKER_TIMEOUT=6000 \
64-
WSGI_WORKER_CLASS='gevent' \
65-
\
66-
# GHC Core Plugins modules and/or classes, seldom needed to set: \
67-
# if not specified here or in Container environment \
68-
# all GHC built-in Plugins will be active. \
69-
#ENV GHC_PLUGINS 'GeoHealthCheck.plugins.probe.owsgetcaps,\
70-
# GeoHealthCheck.plugins.probe.wms, ...., ...\
71-
# GeoHealthCheck.plugins.check.checks' \
72-
\
73-
# GHC User Plugins, best be overridden via Container environment \
74-
GHC_USER_PLUGINS=''
16+
ENV \
17+
LC_ALL="en_US.UTF-8" \
18+
LANG="en_US.UTF-8" \
19+
LANGUAGE="en_US.UTF-8" \
20+
DEB_PACKAGES="locales gunicorn postgresql-client python3-gunicorn python3-gevent python3-psycopg2 python3-lxml python3-pyproj" \
21+
DEB_BUILD_DEPS="make python3-pip"
22+
23+
# GHC ENV settings
24+
ENV \
25+
26+
ADMIN_NAME=admin \
27+
ADMIN_PWD=admin \
28+
GHC_ADMIN_EMAIL='[email protected]' \
29+
GHC_BASIC_AUTH_DISABLED=False \
30+
GHC_GEOIP_LATFIELD='lat' \
31+
GHC_GEOIP_LONFIELD='lon' \
32+
GHC_GEOIP_URL='http://ip-api.com/json/{hostname}' \
33+
GHC_LARGE_XML=False \
34+
GHC_LOG_FORMAT='%(asctime)s - %(name)s - %(levelname)s - %(message)s' \
35+
GHC_LOG_LEVEL=30 \
36+
GHC_METADATA_CACHE_SECS=900 \
37+
GHC_MINIMAL_RUN_FREQUENCY_MINS=10 \
38+
GHC_NOTIFICATIONS=False \
39+
GHC_NOTIFICATIONS_EMAIL='[email protected],[email protected]' \
40+
GHC_NOTIFICATIONS_VERBOSITY=True \
41+
GHC_PROBE_HTTP_TIMEOUT_SECS=30 \
42+
GHC_REQUIRE_WEBAPP_AUTH=False \
43+
GHC_RETENTION_DAYS=30 \
44+
GHC_RUNNER_IN_WEBAPP=False \
45+
GHC_SELF_REGISTER=False \
46+
GHC_SITE_TITLE='GeoHealthCheck' \
47+
GHC_SITE_URL='http://localhost' \
48+
GHC_SMTP_PASSWORD=None \
49+
GHC_SMTP_PORT=None \
50+
GHC_SMTP_SERVER=None \
51+
GHC_SMTP_SSL=False \
52+
GHC_SMTP_TLS=False \
53+
GHC_SMTP_USERNAME=None \
54+
GHC_VERIFY_SSL=True \
55+
GHC_WWW_LINK_EXCEPTION_CHECK=False \
56+
SECRET_KEY='d544ccc37dc3ad214c09b1b7faaa64c60351d5c8bb48b342' \
57+
SQLALCHEMY_DATABASE_URI='sqlite:////GeoHealthCheck/DB/data.db' \
58+
SQLALCHEMY_ENGINE_OPTION_PRE_PING=False
59+
60+
# WSGI server settings, assumed is gunicorn
61+
ENV \
62+
HOST=0.0.0.0 \
63+
PORT=80 \
64+
WSGI_WORKERS=4 \
65+
WSGI_WORKER_TIMEOUT=6000 \
66+
WSGI_WORKER_CLASS='gevent'
67+
68+
# GHC Core Plugins modules and/or classes, seldom needed to set:
69+
# if not specified here or in Container environment
70+
# all GHC built-in Plugins will be active.
71+
#ENV GHC_PLUGINS 'GeoHealthCheck.plugins.probe.owsgetcaps,
72+
# GeoHealthCheck.plugins.probe.wms, ...., ...
73+
# GeoHealthCheck.plugins.check.checks'
74+
75+
# GHC User Plugins, best be overridden via Container environment
76+
ENV GHC_USER_PLUGINS=''
7577

7678
# Install operating system dependencies
7779
RUN \
@@ -90,14 +92,28 @@ COPY . /GeoHealthCheck
9092

9193
# Install
9294
RUN \
93-
chmod a+x /*.sh && ./install.sh \
94-
# Cleanup TODO: remove unused Locales and TZs
95-
&& apt-get remove --purge -y ${DEB_BUILD_DEPS} \
95+
chmod a+x /*.sh \
96+
&& ./install.sh
97+
98+
99+
FROM base AS development
100+
101+
RUN \
102+
apt-get install silversearcher-ag \
103+
&& pip install -r /GeoHealthCheck/requirements-dev.txt
104+
105+
CMD ["/bin/bash"]
106+
107+
108+
FROM base AS runnable
109+
110+
# Cleanup TODO: remove unused Locales and TZs
111+
RUN \
112+
apt-get remove --purge -y ${DEB_BUILD_DEPS} \
96113
&& apt-get clean \
97114
&& apt autoremove -y \
98115
&& rm -rf /var/lib/apt/lists/*
99116

100-
101117
# For SQLite
102118
VOLUME ["/GeoHealthCheck/DB/"]
103119

docker-compose.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
services:
2+
development:
3+
build:
4+
context: .
5+
target: development
6+
env_file:
7+
- .env
8+
volumes:
9+
- .:/GeoHealthCheck
10+
ports:
11+
- 8000:8000
12+
13+
14+
local_runner:
15+
build:
16+
context: .
17+
target: runnable
18+
env_file:
19+
- .env
20+
profiles:
21+
- runner

requirements-dev.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
flake8==5.0.4
22
Paver==1.3.4
33
pylint==2.13.9
4+
python-lsp-server[all,websockets]
5+
debugpy
6+
pylsp-rope
7+
python-lsp-ruff

0 commit comments

Comments
 (0)