docker-compose run --rm web osmosis \
-verbose \
--read-pbf district-of-columbia-latest.osm.pbf \
+ --log-progress \
--write-apidb \
host="db" \
database="openstreetmap" \
ENV DEBIAN_FRONTEND=noninteractive
-# Install system packages
+# Install system packages then clean up to minimize image size
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
-# Install current Osmosis
+# Install compatible Osmosis to help users import sample data in a new instance
RUN curl -OL https://github.com/openstreetmap/osmosis/releases/download/0.47.2/osmosis-0.47.2.tgz \
&& tar -C /usr/local -xzf osmosis-0.47.2.tgz
RUN gem install bundler \
&& bundle install
-# Install NodeJS packages
+# Install NodeJS packages using yarnpkg
+# `bundle exec rake yarn:install` will not work
ADD package.json yarn.lock /app/
RUN yarnpkg install
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
require "bundler/setup" # Set up gems listed in the Gemfile.
-require "bootsnap/setup" if ENV.fetch("ENABLE_BOOTSNAP", "true") == "true" # Speed up boot time by caching expensive operations.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
- web-images:/home/osm/images
ports:
- "3000:3000"
- environment:
- # https://github.com/Shopify/bootsnap/issues/262
- ENABLE_BOOTSNAP: 'false'
command: bundle exec rails s -p 3000 -b '0.0.0.0'
depends_on:
- db
ADD docker/postgres/openstreetmap-postgres-init.sh /docker-entrypoint-initdb.d/
# Custom database functions are in a SQL file.
-ADD db/functions/functions.sql /usr/local/sbin/osm-db-functions.sql
+ADD db/functions/functions.sql /usr/local/share/osm-db-functions.sql
set -ex
# Create 'openstreetmap' user
+# Password and superuser privilege are needed to successfully run test suite
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" <<-EOSQL
CREATE USER openstreetmap SUPERUSER PASSWORD 'openstreetmap';
GRANT ALL PRIVILEGES ON DATABASE openstreetmap TO openstreetmap;
psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -c "CREATE EXTENSION btree_gist" openstreetmap
# Define custom functions
-psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -f "/usr/local/sbin/osm-db-functions.sql" openstreetmap
+psql -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -f "/usr/local/share/osm-db-functions.sql" openstreetmap