Skip to content

Commit 3785d58

Browse files
authored
Container updates for web API Upstream (#795)
* Updata database to support postgis * Update web api container for upstream * Update gitsha for web
1 parent d71c818 commit 3785d58

4 files changed

Lines changed: 33 additions & 9 deletions

File tree

images/db/Dockerfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Stage 1: Compilar el plugin para PostgreSQL 17
21
FROM postgres:17 AS builder
32

4-
# Instalar dependencias de compilación
3+
# Install build dependencies
54
RUN apt-get update && apt-get install -y --no-install-recommends \
65
ca-certificates \
76
build-essential \
@@ -18,7 +17,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1817
&& update-ca-certificates \
1918
&& rm -rf /var/lib/apt/lists/*
2019

21-
# Clonar y compilar el plugin osmdbt para PostgreSQL 17
20+
# Clone and build osmdbt plugin for PostgreSQL 17
2221
RUN git clone https://github.com/openstreetmap/osmdbt.git /tmp/osmdbt && \
2322
cd /tmp/osmdbt && \
2423
git checkout v0.9 && \
@@ -29,6 +28,15 @@ RUN git clone https://github.com/openstreetmap/osmdbt.git /tmp/osmdbt && \
2928

3029
FROM postgres:17
3130

31+
RUN apt-get update && apt-get install -y --no-install-recommends \
32+
postgresql-17-postgis-3 \
33+
postgresql-17-postgis-3-scripts \
34+
&& rm -rf /var/lib/apt/lists/*
35+
36+
# Auto-create required extensions on fresh initdb
37+
COPY ./scripts/init-extensions.sh /docker-entrypoint-initdb.d/10-extensions.sh
38+
RUN chmod +x /docker-entrypoint-initdb.d/10-extensions.sh
39+
3240
COPY --from=builder /tmp/osmdbt/postgresql-plugin/build/osm-logical.so /usr/lib/postgresql/17/lib/osm-logical.so
3341

3442
RUN ln -s /usr/lib/postgresql/17/lib/osm-logical.so /usr/lib/postgresql/17/lib/osm_logical.so
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
set -e
3+
4+
psql --username="$POSTGRES_USER" --dbname="$POSTGRES_DB" -v ON_ERROR_STOP=1 <<-'EOSQL'
5+
CREATE EXTENSION IF NOT EXISTS postgis;
6+
CREATE EXTENSION IF NOT EXISTS hstore;
7+
CREATE EXTENSION IF NOT EXISTS btree_gist;
8+
EOSQL

images/web/Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ruby:3.3-slim AS builder
1+
FROM ruby:3.4-slim AS builder
22

33
ENV DEBIAN_FRONTEND=noninteractive \
44
workdir=/var/www \
@@ -14,9 +14,9 @@ WORKDIR $workdir
1414
RUN apt-get update && \
1515
apt-get install -y --no-install-recommends \
1616
git curl gnupg build-essential \
17-
libarchive-dev zlib1g-dev libcurl4-openssl-dev \
17+
libarchive-dev zlib1g-dev libcurl4-openssl-dev libgd-dev \
1818
apache2 apache2-dev libapache2-mod-fcgid libapr1-dev libaprutil1-dev \
19-
postgresql-client libpq-dev libxml2-dev libyaml-dev libgd-dev \
19+
postgresql-client libpq-dev libxml2-dev libyaml-dev \
2020
pngcrush optipng advancecomp pngquant jhead jpegoptim gifsicle libjpeg-progs unzip\
2121
&& curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
2222
&& apt-get install -y nodejs \
@@ -31,7 +31,7 @@ RUN rm -rf $workdir/* && curl -fsSL $OHM_WEBSITE_URL -o /tmp/ohm-website.zip &&
3131
mv /tmp/ohm-website-$OPENHISTORICALMAP_WEBSITE_GITSHA/* $workdir && \
3232
rm -rf /tmp/*
3333

34-
RUN gem install bundler && \
34+
RUN gem install bundler -v 4.0.11 --no-document && \
3535
bundle install && \
3636
yarn install && \
3737
bundle exec rake yarn:install
@@ -77,7 +77,7 @@ RUN git clone https://github.com/OpenHistoricalMap/leaflet-ohm-timeslider-v2.git
7777
cp leaflet-ohm-timeslider.* $workdir/app/assets/stylesheets/ && \
7878
cp assets/* $workdir/app/assets/images/
7979

80-
FROM ruby:3.3-slim
80+
FROM ruby:3.4-slim
8181

8282
ENV DEBIAN_FRONTEND=noninteractive \
8383
workdir=/var/www \
@@ -116,14 +116,15 @@ RUN BUILD_DEPS=" \
116116
gifsicle \
117117
postgresql-client \
118118
curl \
119+
git \
119120
libvips \
120121
nodejs \
121122
\
122123
&& npm install -g svgo \
123124
\
124125
# Install Passenger as a gem and compile the Apache module
125126
\
126-
&& gem install passenger --no-document \
127+
&& gem install passenger -v 6.1.3 --no-document \
127128
&& yes | passenger-install-apache2-module --auto --languages ruby \
128129
&& passenger-config validate-install --auto \
129130
\
@@ -152,6 +153,10 @@ RUN a2enmod headers setenvif proxy proxy_http proxy_fcgi fcgid rewrite lbmethod_
152153
echo "ServerName localhost" >> /etc/apache2/apache2.conf && \
153154
apache2ctl configtest
154155

156+
# Install bundler matching ohm-website Gemfile.lock to avoid Passenger preloader Gem::LoadError.
157+
RUN gem install bundler -v 4.0.11 --no-document
158+
159+
155160
RUN echo '#!/bin/bash\nexec /usr/local/bin/ruby --yjit --yjit-exec-mem-size=64 "$@"' > /usr/local/bin/ruby_yjit && \
156161
chmod +x /usr/local/bin/ruby_yjit
157162

images/web/config/production.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
DocumentRoot /var/www/public
55
PassengerAppEnv production
66
PassengerRuby /usr/local/bin/ruby
7+
# Load Bundler before Ruby preloads default gems so Gemfile.lock pins
8+
# (e.g. stringio 3.2.0) win over Ruby-bundled defaults like 3.1.2.
9+
PassengerPreloadBundler on
710
RewriteEngine On
811

912
# Redirect to HTTPS

0 commit comments

Comments
 (0)