-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6c8438
commit efe462b
Showing
3 changed files
with
123 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,56 @@ | ||
name: Docker image | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- 'v[0-9]+.[0-9]+.[0-9]+' | ||
pull_request: | ||
branches: | ||
- '*' | ||
jobs: | ||
build: | ||
name: Build & push docker image | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
psql: [15] | ||
postgis: [3.4] | ||
os: [ubuntu-latest] | ||
|
||
env: | ||
IMG_NAME: ${{ github.repository }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Info | ||
run: echo "Parameters. ${{ github.event.base_ref }}, ${{ github.ref_type }}, ${{ github.ref }}" | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
context: . | ||
file: ./docker/Dockerfile | ||
push: true | ||
tags: mobilitydb/mobilitydb:${{ matrix.psql }}-${{ matrix.postgis }}-1.0-workshop | ||
build-args: | | ||
POSTGRES_VERSION=${{ matrix.psql }} | ||
POSTGIS_VERSION=${{ matrix.postgis }} |
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,56 @@ | ||
ARG POSTGRES_VERSION | ||
ARG POSTGIS_VERSION | ||
|
||
FROM postgis/postgis:$POSTGRES_VERSION-$POSTGIS_VERSION | ||
|
||
# Configuration Parameters | ||
LABEL maintainer="MobilityDB Project - https://github.com/MobilityDB/MobilityDB" | ||
ENV POSTGRES_DB=mobilitydb | ||
ENV POSTGRES_USER=docker | ||
ENV POSTGRES_PASSWORD=docker | ||
ENV MOBILITYDB_VERSION $MOBDB_VERSION | ||
|
||
# Fix the Release file expired problem | ||
RUN echo "Acquire::Check-Valid-Until \"false\";\nAcquire::Check-Date \"false\";" | cat > /etc/apt/apt.conf.d/10no--check-valid-until | ||
|
||
|
||
# Install Prerequisites | ||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
build-essential \ | ||
cmake \ | ||
git \ | ||
libproj-dev \ | ||
g++ \ | ||
wget \ | ||
autoconf \ | ||
autotools-dev \ | ||
libgeos-dev \ | ||
libpq-dev \ | ||
libproj-dev \ | ||
libjson-c-dev \ | ||
protobuf-c-compiler \ | ||
xsltproc \ | ||
libgsl-dev \ | ||
libgslcblas0 \ | ||
postgresql-server-dev-${PG_MAJOR} \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install MobilityDB | ||
RUN wget -O MobilityDB.tar.gz "https://github.com/MobilityDB/MobilityDB/archive/v1.0.tar.gz" \ | ||
&& mkdir -p /usr/local/src/MobilityDB \ | ||
&& tar \ | ||
--extract \ | ||
--file MobilityDB.tar.gz \ | ||
--directory /usr/local/src/MobilityDB \ | ||
--strip-components 1 \ | ||
&& rm MobilityDB.tar.gz | ||
RUN mkdir /usr/local/src/MobilityDB/build | ||
RUN cd /usr/local/src/MobilityDB/build && \ | ||
cmake .. && \ | ||
make -j$(nproc) && \ | ||
make install | ||
|
||
RUN rm /docker-entrypoint-initdb.d/10_postgis.sh | ||
COPY ./docker/initdb-mobilitydb.sh /docker-entrypoint-initdb.d/mobilitydb.sh | ||
RUN chmod +x /docker-entrypoint-initdb.d/mobilitydb.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,11 @@ | ||
#!/bin/bash | ||
|
||
echo "shared_preload_libraries = 'postgis-3.so'" >> $PGDATA/postgresql.conf | ||
|
||
set -e | ||
|
||
# Create the 'mobilitydb' extension in the mobilitydb database | ||
echo "Loading MobilityDB extension into mobilitydb" | ||
psql --user="$POSTGRES_USER" --dbname="mobilitydb" <<- 'EOSQL' | ||
CREATE EXTENSION IF NOT EXISTS mobilitydb CASCADE; | ||
EOSQL |