Docker-compose entrypoint script stops container with exit 0

After the execution of my entrypoint script the containers stops with Exit 0. The command specified in the compose file which is starting our webserver is ignored.

We are using docker with docker-compose as environment for our rails applications.

The entrypoint script:

#! /bin/bash
bundle exec rails assets:clobber
bundle exec rails assets:precompile

bundle exec rake db:exists && bundle exec rake db:migrate || bundle exec rake db:setup

rm -rf /aps/tmp/pids/server.pid

The compose file:

version: '2'
services:
  app:
    image: registry.gitlab.com/.../.../master:latest
    command: bundle exec rails server
    entrypoint: /aps/rails-entrypoint.sh
    volumes:
      - /srv/app/log/:/app/log
      - /srv/app/public/:/app/public
    env_file: .env
    ports:
      - '0.0.0.0:3333:3000'
    links:
      - apppostgres

  apppostgres:
    image: postgres
    ...


volumes:
  pgdata:

When I connect into the container while the entrypoint script is running I can see the executed command running with ps aux as /bin/bash /app/rails-entrypoint.sh bundle exec rails server.

When I add my command block to the entrypointscript the server is started and running but this is nor how it should work or?

What can I do to get the entrypoint script and command block running as they should?

Source: StackOverflow