-
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #690 from spwoodcock/build/josm-docker-dev
Add JOSM API to docker compose dev stack
- Loading branch information
Showing
8 changed files
with
209 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Copyright (c) 2022, 2023 Humanitarian OpenStreetMap Team | ||
# This file is part of FMTM. | ||
# | ||
# FMTM is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# FMTM is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with FMTM. If not, see <https:#www.gnu.org/licenses/>. | ||
# | ||
|
||
version: "3" | ||
|
||
networks: | ||
x11: | ||
|
||
services: | ||
josm: | ||
image: "ghcr.io/hotosm/fmtm/josm:latest" | ||
build: | ||
context: josm | ||
container_name: josm | ||
environment: | ||
- DISPLAY=josm-novnc:0.0 | ||
depends_on: | ||
- josm-novnc | ||
networks: | ||
- fmtm-dev | ||
- x11 | ||
ports: | ||
- 8111:80 | ||
restart: unless-stopped | ||
|
||
josm-novnc: | ||
image: "ghcr.io/hotosm/fmtm/josm-novnc:latest" | ||
build: | ||
context: josm/novnc | ||
container_name: josm_novnc | ||
environment: | ||
- DISPLAY_WIDTH=1280 | ||
- DISPLAY_HEIGHT=600 | ||
- RUN_XTERM=no | ||
- RUN_FLUXBOX=no | ||
ports: | ||
- "8112:8080" | ||
networks: | ||
- x11 | ||
restart: unless-stopped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Copyright (c) 2022, 2023 Humanitarian OpenStreetMap Team | ||
# This file is part of FMTM. | ||
# | ||
# FMTM is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# FMTM is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with FMTM. If not, see <https:#www.gnu.org/licenses/>. | ||
# | ||
|
||
FROM docker.io/debian:bookworm as base | ||
ARG MAINTAINER=admin@hotosm.org | ||
LABEL org.hotosm.fmtm.maintainer="${MAINTAINER}" \ | ||
org.hotosm.fmtm.josm-port="8111" \ | ||
org.hotosm.fmtm.nginx-port="80" | ||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install \ | ||
-y --no-install-recommends "locales" "ca-certificates" \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& update-ca-certificates | ||
# Set locale | ||
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen | ||
ENV LANG en_US.UTF-8 | ||
ENV LANGUAGE en_US:en | ||
ENV LC_ALL en_US.UTF-8 | ||
|
||
|
||
|
||
FROM base as gpg-key | ||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install \ | ||
-y --no-install-recommends \ | ||
"curl" \ | ||
"gnupg2" \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN curl -sS https://josm.openstreetmap.de/josm-apt.key \ | ||
| gpg --dearmor | tee /opt/josm.gpg | ||
|
||
|
||
|
||
FROM base as runtime | ||
COPY --from=gpg-key \ | ||
/opt/josm.gpg /etc/apt/trusted.gpg.d/josm.gpg | ||
RUN echo \ | ||
"deb [arch=$(dpkg --print-architecture) \ | ||
signed-by=/etc/apt/trusted.gpg.d/josm.gpg] \ | ||
https://josm.openstreetmap.de/apt alldist universe" \ | ||
| tee /etc/apt/sources.list.d/josm.list > /dev/null | ||
RUN set -ex \ | ||
&& apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install \ | ||
-y --no-install-recommends \ | ||
"gosu" \ | ||
"josm" \ | ||
"nginx" \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
COPY container-entrypoint.sh /container-entrypoint.sh | ||
# Add non-root user | ||
RUN useradd --system -r -u 101 -m -c "nginx user" \ | ||
-d /home/nginx -s /bin/false nginx \ | ||
&& chmod +x /container-entrypoint.sh | ||
COPY --chown=nginx \ | ||
preferences.xml /home/nginx/.config/JOSM/preferences.xml | ||
# Replace default nginx config | ||
COPY --chown=nginx \ | ||
nginx-josm.conf /etc/nginx/sites-enabled/default | ||
# Run as root, change to nginx user in entrypoint | ||
ENTRYPOINT ["/container-entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# Start JOSM as nginx (unpriv) user | ||
gosu nginx josm & | ||
|
||
exec nginx -g "daemon off;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
server { | ||
listen 80 default_server; | ||
server_name _; | ||
|
||
location / { | ||
proxy_pass http://127.0.0.1:8111; | ||
} | ||
|
||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM docker.io/theasp/novnc:latest | ||
COPY index.html /usr/share/novnc/ | ||
RUN useradd -r -u 900 -m -c "novnc account" -d /home/appuser -s /bin/false appuser \ | ||
&& chown -R appuser:appuser /app | ||
WORKDIR /app | ||
USER appuser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<html> | ||
<head> | ||
<meta http-equiv="refresh" content="0; URL=vnc.html?resize=scale" /> | ||
</head> | ||
<body> | ||
<p>If you see this <a href="vnc.html?resize=scale">click here</a>.</p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<preferences xmlns='http://josm.openstreetmap.de/preferences-1.0' version='18789'> | ||
<tag key='josm.version' value='18789'/> | ||
<tag key='draw.splashscreen' value='false'/> | ||
<tag key='expert' value='true'/> | ||
<tag key='gui.start.animation' value='false'/> | ||
<tag key='cache.capabilities1637351842' value='1691490836'/> | ||
<tag key='cache.motd.html' value='1691490835'/> | ||
<tag key='cache.motd.html.java' value='11.0.18'/> | ||
<tag key='cache.motd.html.lang' value='En:'/> | ||
<tag key='cache.motd.html.version' value='18789'/> | ||
<tag key='draw.rawgps.colormode' value='0'/> | ||
<tag key='draw.rawgps.lines' value='2'/> | ||
<tag key='mappaint.renderer-class-name' value='org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer'/> | ||
<tag key='oauth.use-for-all-requests' value='false'/> | ||
<tag key='org.openstreetmap.josm.gui.preferences.PreferenceDialog.geometry' value='x=1610,y=585,width=800,height=774'/> | ||
<tag key='preferences.reset.draw.rawgps.lines' value='true'/> | ||
<list key='projection.sub.core:mercator'> | ||
</list> | ||
<tag key='propertiesdialog.preview-on-hover' value='false'/> | ||
<tag key='proxy.policy' value='no-proxy'/> | ||
<tag key='remotecontrol.enabled' value='true'/> | ||
<list key='validator.skip'> | ||
</list> | ||
<list key='validator.skipBeforeUpload'> | ||
</list> | ||
</preferences> |