docker-compose.yml

  
version: '3.3'  
  
services:  
  ethereum_etl:  
    build:  
      context: .  
    env_file: .env  
    volumes:  
      - /var/log/hardblue/etl/:/ethereum-etl/output:rw  
      #- /root/go/src/github.com/ethereum/go-ethereum/build/bin/data:/ethereum-etl/ipc  
    #restart: unless-stopped  
    networks:  
      - etl  
  
networks:  
  etl:  
    driver: bridge  

.env

  
STARTBLOCK=00000000  

DOCKERFILE

  
FROM python:3.6-alpine  
MAINTAINER Eric Lim   
ENV PROJECT_DIR=ethereum-etl  
  
RUN apk add unzip  
RUN wget https://github.com/blockchain-etl/ethereum-etl/archive/develop.zip \  
&& unzip develop.zip && rm develop.zip  
  
RUN mv ethereum-etl-develop /$PROJECT_DIR  
  
WORKDIR /$PROJECT_DIR  
RUN apk add --no-cache gcc musl-dev  #for C libraries:    
RUN pip install --upgrade pip && pip install -e /$PROJECT_DIR/  
  
#CMD ["export_all", "-s", "01990000", "-e", "99999999", "-p", "http://xxx.xxx.xxx.xxx:8545", "-o", "output"]  
#CMD ["sh","-c", "echo startblock=$STARTBLOCK  endblock=$ENDBLOCK"]  
  
CMD ["sh","-c","python ethereumetl export_all -s $STARTBLOCK -e $ENDBLOCK  -p http://xxx.xxx.xxx.xxx:8545 -o output"]

crontab -e

  
#!/bin/sh  
  
cd /docker-compose directory/ethereum_etl  
docker-compose up  

PS:First docker-compose build. Use docker-compose up, don’t use docker-compose start that can’t import .env STARTBLOCK