spiral / app

Spiral Framework Skeleton HTTP Application: Queue, Console, Cycle ORM
https://spiral.dev/
MIT License
191 stars 20 forks source link

Dockerfile #7

Closed hotrush closed 4 years ago

hotrush commented 4 years ago

You really need to have a Dockerfile in this repo 😃

wolfy-j commented 4 years ago

I'll check what we can do after the official announcement :)

krwu commented 4 years ago

There will be various config parameters in users' applications. Each app should have its own Dockerfile and CI/CD pipeline for building production images.

Without considering any customized configuration, it's easy to write a sample Dockerfile:

FROM php:7.4-cli-alpine

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
    && curl -sSL -o /usr/bin/composer 'https://getcomposer.org/composer-stable.phar' \
    && chmod +x /usr/bin/composer

ADD . /usr/src/spiral
WORKDIR /usr/src/spiral

RUN composer install --no-progress --no-dev -o --prefer-dist \
    && ./vendor/bin/spiral get-binary

RUN cp .env.sample .env \
    && php app.php encrypt:key -m .env \
    && php app.php configure -vv

CMD ["./spiral", "serve", "-v"]
hotrush commented 4 years ago

@krwu thanks, i've made something like this myself.

But met several issues:

krwu commented 4 years ago

@hotrush I tested the Dockerfile above, relative path works.

For restarting the server on code changing, check out this: docker/compose#184, I'm not sure if it can help you.

hotrush commented 4 years ago

@krwu actually i don't think that i need to rebuild container on code changes, just need to restart rr somehow. For http next config works for me:

pool:
      numWorkers: 1
      maxJobs:    1

Maybe same options exist for grpc server?

wolfy-j commented 4 years ago

Yes it does exists for GRPC and jobs. also read about reload service (from 1.6.2).

hotrush commented 4 years ago

@wolfy-j thanks, will try, just didn't find any docs for grpc server at spiral or roadrunner websites, will try experimentally. I've seen reload feature, but it looks too resources-intensive with docker, maybe because of slow fs or smth

wolfy-j commented 4 years ago

https://spiral.dev/docs/grpc-configuration