Sha256: a2fad85574a52cf6f862becac2b2a11f7e8a1c482b3d78b6242bf210e71d939a

Contents?: true

Size: 1.1 KB

Versions: 93

Compression:

Stored size: 1.1 KB

Contents

module Souls
  module Docker
    class << self
      def psql
        system(
          "docker run --rm -d \
            -p 5433:5432 \
            -v postgres-tmp:/var/lib/postgresql/data \
            -e POSTGRES_USER=postgres \
            -e POSTGRES_PASSWORD=postgres \
            -e POSTGRES_DB=souls_test \
            postgres:13-alpine"
        )
        system("docker ps")
      end

      def mysql
        system(
          "docker run --rm -d \
            -p 3306:3306 \
            -v mysql-tmp:/var/lib/mysql \
            -e MYSQL_USER=mysql \
            -e MYSQL_ROOT_PASSWORD=mysql \
            -e MYSQL_DB=souls_test \
            mysql:latest"
        )
        system("docker ps")
      end

      def run
        current_dir_name = FileUtils.pwd.to_s.match(%r{/([^/]+)/?$})[1]
        port =
          if current_dir_name == "api"
            "4000:4000"
          else
            "3000:3000"
          end
        system("docker build . -t souls-app -f Dockerfile.dev")
        system("docker run --name souls-app --rm --env-file .env -p #{port} souls-app:latest")
      end
    end
  end
end

Version data entries

93 entries across 93 versions & 1 rubygems

Version Path
souls-0.51.2 lib/souls/cli/docker/index.rb
souls-0.51.1 lib/souls/cli/docker/index.rb
souls-0.51.0 lib/souls/cli/docker/index.rb
souls-0.50.0 lib/souls/cli/docker/index.rb
souls-0.49.0 lib/souls/cli/docker/index.rb
souls-0.48.2 lib/souls/cli/docker/index.rb
souls-0.48.1 lib/souls/cli/docker/index.rb
souls-0.48.0 lib/souls/cli/docker/index.rb
souls-0.47.1 lib/souls/cli/docker/index.rb
souls-0.47.0 lib/souls/cli/docker/index.rb
souls-0.46.1 lib/souls/cli/docker/index.rb
souls-0.46.0 lib/souls/cli/docker/index.rb
souls-0.45.4 lib/souls/cli/docker/index.rb
souls-0.45.3 lib/souls/cli/docker/index.rb
souls-0.45.2 lib/souls/cli/docker/index.rb
souls-0.45.1 lib/souls/cli/docker/index.rb
souls-0.45.0 lib/souls/cli/docker/index.rb
souls-0.44.6 lib/souls/cli/docker/index.rb
souls-0.44.5 lib/souls/cli/docker/index.rb
souls-0.44.4 lib/souls/cli/docker/index.rb