Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added fully configured Docker image #83

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mKeRix
Copy link

@mKeRix mKeRix commented Feb 12, 2018

Hey there,

the previous Docker support didn't quite adhere to Docker principles and made Packages sort of painful to setup on production. I've rewritten the Docker files to generate fully configured instance of the application that can easily be deployed.

You can see the results here: https://hub.docker.com/r/mkerix/packages/

Important tasks after merging

  • Add an official automated build on Docker Hub. You can follow the official documentation for this and keep the default settings. In the Build Settings tab of your new project please add a repository link to webdevops/php-nginx.
  • Update the links and docker-compose file in the README to reflect your new official Docker image.

Please let me know if you have any questions!

@tyler-sommer
Copy link
Member

This is a fantastic idea, thank you for submitting the PR and doing all the leg work. I'll take a look at getting this done for the next release.

Thanks for using Packages!

@tyler-sommer tyler-sommer added this to the 3.2.1 milestone Feb 13, 2018
@@ -0,0 +1,42 @@
FROM composer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Composer is already included in webdevops/php-nginx:7.2 and updated on every image build.

ENV WEB_DOCUMENT_ROOT=/app/web
ENV COMPOSER_ALLOW_SUPERUSER 1

ENV PACKAGES_NAME='Terramar Labs'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep the amount of image layers as small as possible, you should use:

ENV FOO='Bar' \
         BAR='Baz'


COPY --from=0 /usr/bin/composer /usr/bin/composer

RUN apt-get update \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The webdevops image contains a helpful wrapper apt-install gettext-base procps which updates, installs and cleans afterwards.


COPY . /app
COPY ./docker/nginx/vhost.common.d/vhost.common.conf /opt/docker/etc/nginx/vhost.common.d/10-location-root.conf
RUN chown -R 1000:1000 /app
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduce number of image layers also here by executing concatenated RUN commands

&& ssh-keyscan -t rsa bitbucket.org >> /root/.ssh/known_hosts \
&& ssh-keyscan -t rsa gitlab.com >> /root/.ssh/known_hosts

ENTRYPOINT envsubst < config.yml.tmpl > config.yml \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should add a supervisord service for the resque worker and there's also a mechanism for doing startup commands in the docker container: service.d scripts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants