I created a dockerfile and a docker-compose in order to mount an image with some instructions. The instruction I would like to use is as follows:
raster2pgsql -s 4326 -C -F -I -t 100x100 /data/dem/w*.tif public.italy | PGPASSWORD=password psql -h localhost -p 5432 -U admin -d elevation
By opening the container terminal and typing this instruction, everything proceeds smoothly. What I would like to do, to avoid running all the times is to enter this instruction inside my dockerfile but I couldn't get anything, not even an error message:
RUN raster2pgsql -s 4326 -C -F -I -t 100x100 /data/dem/w*.tif public.italy && PGPASSWORD=password psql -h localhost -p 5432 -U admin -d elevation
my dockerfile:
FROM kartoza/postgis
# LABEL about the custom image
LABEL maintainer="xx.yy@gmail.com"
LABEL version="0.1"
LABEL description="This is a custom Docker Image for elevation data."
RUN apt-get update && apt-get install -y \
gdal-bin \
postgis \
&& rm -rf /var/lib/apt/lists/*
COPY ./dem/* /data/dem/
RUN raster2pgsql -s 4326 -C -F -I -t 100x100 /data/dem/w*.tif public.italy | PGPASSWORD=password psql -h localhost -p 5432 -U admin -d elevation
and
version: "3.8"
services:
postgis:
build:
context: .
dockerfile: ./Dockerfile
#image: kartoza/postgis:${POSTGIS_VERSION_TAG}
container_name: postgis
ports:
- "5432:5432"
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASS=${POSTGRES_PASS}
- POSTGRES_DB=${POSTGRES_DB}
- ALLOW_IP_RANGE=${POSTGRES_ALLOW_IP_RANGE}
- POSTGRES_MULTIPLE_EXTENSIONS=${POSTGRES_MULTIPLE_EXTENSIONS}
- POSTGRES_DATA_VOLUME:${POSTGRES_DATA_VOLUME}
restart: on-failure
volumes:
- postgis-data:${POSTGRES_DATA_VOLUME}
networks:
- postgis_network
pgadmin:
image: dpage/pgadmin4:${PGADIM_VERION_TAG}
container_name: ${PGADIM_CONTAINER_NAME}
ports:
- "5050:80"
restart: always
environment:
- PGADMIN_DEFAULT_EMAIL=${PGADMIN_DEFAULT_EMAIL}
- PGADMIN_DEFAULT_PASSWORD=${PGADMIN_DEFAULT_PASSWORD}
- PGADMIN_CONFIG_SERVER_MODE:${PGADMIN_CONFIG_SERVER_MODE}
networks:
- postgis_network
volumes:
- pgadmin-data:${PGADIM_DATA_VOLUME}
#depends_on:
#postgis:
#condition: service_healthy
cloudbeaver:
image: dbeaver/cloudbeaver:23.1.0
container_name: cloudbeaver_container
restart: always
ports:
- "8085:8978"
volumes:
- cloudbeaver-data:/opt/cloudbeaver/workspace
networks:
- postgis_network
volumes:
postgis-data:
pgadmin-data:
cloudbeaver-data:
networks:
postgis_network:
driver: bridge