Giter VIP home page Giter VIP logo

Comments (9)

omron93 avatar omron93 commented on July 22, 2024

I do not found a Script, that copies the Skripts from php-pre-init or php-post-assemble.
Maybe it is some missing in s2i-php-container like:

They are copied in assemble script by mv /tmp/src/* ./ - so then they reside in /opt/app-root/src/.

And are sources in
https://github.com/sclorg/s2i-php-container/blob/master/7.1/s2i/bin/assemble#L52
https://github.com/sclorg/s2i-php-container/blob/master/7.1/s2i/bin/run#L54

Problem with you example is that ${HTTPD_APP_ROOT} is not defined. Use ${APP_ROOT} instead. Then your example worked for me with docker as I would expect.

(I do not know, how the pre-init scirpts get started inside the builted image.)

You should see output like this

$ docker run -ti --rm 4781c1cf7e96
=> sourcing 20-copy-config.sh ...
---> 11:09:28     Processing additional arbitrary httpd configuration provided by s2i ...
=> sourcing 00-documentroot.conf ...
=> sourcing 50-mpm-tuning.conf ...
=> sourcing 40-ssl-certs.sh ...
=> sourcing modifyindex.sh ...
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
...

How can I inject a .sh script from my source code repository into the resulting image, that runs once during a pod starts and the pod get ready?

php-pre-start directory is not what you need?

from s2i-php-container.

dirkrydvan avatar dirkrydvan commented on July 22, 2024

How can I inject a .sh script from my source code repository into the resulting image, that runs once during a pod starts and the pod get ready?

php-pre-start directory is not what you need?

I tried this before.
[X] The *.sh script placed under ./php-pre-start it exists after the build in the started pod.
[ ] But - it will never started inside the pod.

You should see output like this
=> sourcing 00-documentroot.conf ...
=> sourcing 50-mpm-tuning.conf ...
=> sourcing 40-ssl-certs.sh ...
=> sourcing modifyindex.sh ...

I 'd rather say no: the complete build output is:

  | Cloning "https://github.com/dirkrydvan/phpmyadmin" ...
-- | --
  | Commit:	95422809ccc41fb2654ec8e3396620c96e0e4287 (wq)
  | Author:	Quellcodezugriff <[email protected]>
  | Date:	Thu Jun 7 17:54:00 2018 +0200
  |  
  | ---> Installing application source...
  | Found 'composer.json', installing dependencies using composer.phar...
  | Downloading https://getcomposer.org/installer, attempt 1/6
  | % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  | Dload  Upload   Total   Spent    Left  Speed
  | 0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0 100  298k  100  298k    0     0   523k      0 --:--:-- --:--:-- --:--:--  526k
  | All settings correct for using Composer
  | Downloading...
  |  
  | Composer (version 1.6.5) successfully installed to: /opt/app-root/src/composer.phar
  | Use it: php composer.phar
  |  
  | Loading composer repositories with package information
  | Installing dependencies (including require-dev) from lock file
  | Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
  | Package operations: 30 installs, 0 updates, 0 removals
  | - Installing psr/log (1.0.2): Downloading (100%)
  | - Installing symfony/debug (v2.8.38): Downloading (100%)
  | - Installing symfony/console (v2.8.38): Downloading (100%)
  | - Installing symfony/process (v2.8.38): Downloading (100%)
  | - Installing gitonomy/gitlib (v1.0.3): Downloading (100%)
  | - Installing codacy/coverage (1.4.2): Downloading (100%)
  | - Installing phpdocumentor/reflection-common (1.0.1): Downloading (100%)
  | - Installing phpdocumentor/type-resolver (0.3.0): Downloading (100%)
  | - Installing squizlabs/php_codesniffer (3.2.3): Downloading (100%)
  | - Installing phpmyadmin/coding-standard (0.3): Downloading (100%)
  | - Installing sebastian/recursion-context (1.0.5): Downloading (100%)
  | - Installing sebastian/exporter (1.2.2): Downloading (100%)
  | - Installing sebastian/diff (1.4.3): Downloading (100%)
  | - Installing sebastian/comparator (1.2.4): Downloading (100%)
  | - Installing webmozart/assert (1.3.0): Downloading (100%)
  | - Installing phpdocumentor/reflection-docblock (3.2.2): Downloading (100%)
  | - Installing doctrine/instantiator (1.0.5): Downloading (100%)
  | - Installing phpspec/prophecy (1.7.6): Downloading (100%)
  | - Installing sebastian/version (1.0.6): Downloading (100%)
  | - Installing sebastian/environment (1.3.8): Downloading (100%)
  | - Installing phpunit/php-token-stream (1.4.12): Downloading (100%)
  | - Installing phpunit/php-text-template (1.2.1): Downloading (100%)
  | - Installing phpunit/php-file-iterator (1.4.5): Downloading (100%)
  | - Installing phpunit/php-code-coverage (2.2.4): Downloading (100%)
  | - Installing phpunit/php-timer (1.0.9): Downloading (100%)
  | - Installing phpunit/phpunit-mock-objects (2.3.8): Downloading (100%)
  | - Installing symfony/yaml (v2.8.38): Downloading (100%)
  | - Installing sebastian/global-state (1.1.1): Downloading (100%)
  | - Installing phpunit/phpunit (4.8.36): Downloading (100%)
  | - Installing phpunit/phpunit-selenium (1.4.2): Downloading (100%)
  | symfony/console suggests installing symfony/event-dispatcher ()
  | phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)
  | sebastian/global-state suggests installing ext-uopz (*)
  | phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
  | Generating optimized autoload files
  |  
  |  
  | Pushing image 172.30.119.75:5000/infra/phpmyadmin:0.1 ...
  | Pushed 5/6 layers, 84% complete
  | Pushed 6/6 layers, 100% complete
  | Push successful

from s2i-php-container.

omron93 avatar omron93 commented on July 22, 2024

When I try https://github.com/dirkrydvan/phpmyadmin with php image from openshift catalog (centos/php-70-centos7@sha256:bbefd548985b5c642564e4f2a6c32691457e57d155df920e6a115d94195f6713)
I get:

...
  - Installing phpunit/php-timer (1.0.9): Downloading (100%)
  - Installing phpunit/phpunit-mock-objects (2.3.8): Downloading (100%)
  - Installing symfony/yaml (v2.8.38): Downloading (100%)
  - Installing sebastian/global-state (1.1.1): Downloading (100%)
  - Installing phpunit/phpunit (4.8.36): Downloading (100%)
  - Installing phpunit/phpunit-selenium (1.4.2): Downloading (100%)
symfony/console suggests installing symfony/event-dispatcher ()
phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
Generating optimized autoload files
=> sourcing 20-copy-config.sh ...
---> 12:43:00     Processing additional arbitrary httpd configuration provided by s2i ...
=> sourcing 00-documentroot.conf ...
=> sourcing 50-mpm-tuning.conf ...
=> sourcing 40-ssl-certs.sh ...
=> sourcing test.sh ...
./php-post-assemble//test.sh: line 1: /src/index2.html: No such file or directory
error: build error: non-zero (13) exit code from centos/php-70-centos7@sha256:bbefd548985b5c642564e4f2a6c32691457e57d155df920e6a115d94195f6713

@dirkrydvan What builder image are you using? (can be found for example in build Details)

from s2i-php-container.

dirkrydvan avatar dirkrydvan commented on July 22, 2024

It looks really different....

Build Strategy: Source
Builder Image: registry.access.redhat.com/rhscl/php-71-rhel7
Source Type: Git
Source Repo: https://github.com/dirkrydvan/phpmyadmin

from s2i-php-container.

omron93 avatar omron93 commented on July 22, 2024

It's weird, for me with registry.access.redhat.com/rhscl/php-71-rhel7 s2i build is "=> sourcing" extending files too.

@bparees Any idea what could cause a difference? Or how to "debug" it more?

from s2i-php-container.

bparees avatar bparees commented on July 22, 2024

@omron93 difference between what you and @dirkrydvan are seeing when doing the same action?

Couple suggestions:

  1. docker run the image w/ a shell entrypoint and examine the assemble script, make sure it's what you think it is
  2. docker pull the latest images to make sure you're both using the latest
  3. check image shas to confirm (2)
  4. make sure assemble isn't being overridden via a .s2i/bin/assemble script in the source repo

from s2i-php-container.

dirkrydvan avatar dirkrydvan commented on July 22, 2024

Right - we should compare....

  1. docker run the image w/ a shell entrypoint and examine the assemble script, make sure it's what you think it is

My target is to place a .sh script into the final image, which get started before httpd (php-pre-init).
The thing with php-post-assemble is only a test of the other defined functional folder builder image

(My plan is to use a shell script to create a .htaccess and htpasswd with basic auth from secrets via processing env or volume mount - now I use a dirty workaround with a configmap and a link, that points to the configmap mount point)

  1. docker pull the latest images to make sure you're both using the latest

I think so:

Name
rhscl/php-71-rhel7
Summary
Platform for building and running PHP 7.1 applications
Description
PHP 7.1 available as docker container is a base platform for building and running various PHP 7.1 applications and frameworks. PHP is an HTML-embedded scripting language. PHP attempts to make it easy for developers to write dynamically generated web pages. PHP also offers built-in database integration for several commercial and non-commercial database management systems, so writing a database-enabled webpage with PHP is fairly simple. The most common use of PHP coding is probably as a replacement for CGI scripts.
Source URL
 https://access.redhat.com/containers/#/registry.access.redhat.com/rhscl/php-71-rhel7/images/1-9
Author
Unknown
Built
6 months ago
Digest
sha256:667425d7bd60980a987d48bc561ca5c416141b9e68ee34fbf610c2428730fd44
  1. check image shas to confirm (2)
Layers:
15.4 MB sha256:ed65fe78cfadd5079a189dfb27ca042941085750da28ced1f4e02c1e56106d19
43.0 MB sha256:e7e5f441db2e24ac9c2e2955620df08002f788d2d3824ecce83cd614df66b826
86.3 MB sha256:ece526ca56f23055d8c3e5b45fbbec1cce98e22107443d1158e9e4282fdf1591
5.1 MB sha256:fd78159fc44debbf6ca141a97f19899a45c046eaf72fae234dde0ac0a88acf2b
1239 B sha256:bd041d5c5c31c3d843d4e32023b4bccc17210841bca55b4a56cdb0dac4ea7fa1
71.4 MB sha256:4ef5114500595f48bb8b527d86883e61d3c588ca3524c6e7c0b4dc73b0cd4942
  1. make sure assemble isn't being overridden via a .s2i/bin/assemble script in the source repo

I do not see a file whom is able to override assemble.....

Here is also my build config:

apiVersion: v1
kind: BuildConfig
metadata:
  name: phpmyadmin
  namespace: infra
  labels:
    app: phpmyadmin
spec:
  triggers: []
  runPolicy: Serial
  source:
    type: Git
    git:
      uri: 'https://github.com/dirkrydvan/phpmyadmin'
  strategy:
    type: Source
    sourceStrategy:
      from:
        kind: DockerImage
        name: registry.access.redhat.com/rhscl/php-71-rhel7
  output:
    to:
      kind: ImageStreamTag
      name: 'phpmyadmin:0.1'

from s2i-php-container.

omron93 avatar omron93 commented on July 22, 2024

@dirkrydvan Thanks for provided information.

docker pull the latest images to make sure you're both using the latest

This could be the problem. registry.access.redhat.com/rhscl/php-71-rhel7:1-9 is quite old and isn't extendible in the same way.

Latest php-71-rhel7 image has tag 1-15. Please pull the latest image and try a build again.

from s2i-php-container.

hhorak avatar hhorak commented on July 22, 2024

This looks to be solved by using a recent image.

from s2i-php-container.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.