AmpersandTarski / Ampersand

Build database applications faster than anyone else, and keep your data pollution free as a bonus.
http://ampersandtarski.github.io/
GNU General Public License v3.0
40 stars 8 forks source link

cannot access '/var/www/log' in project-template #1412

Closed stefjoosten closed 3 months ago

stefjoosten commented 1 year ago

What happened

I was tyring to build an image from the prototype-template repo. On the fifth step of the Dockerfile, the following error occurred:

sjo00577@BA92-VYF9TXMD9G Switch_demo % docker compose build
[+] Building 27.0s (9/9) FINISHED                                                                                                                                                                                         
 => [internal] load build definition from Dockerfile                                                                                                                                                                 0.0s
 => => transferring dockerfile: 1.28kB                                                                                                                                                                               0.0s
 => [internal] load .dockerignore                                                                                                                                                                                    0.0s
 => => transferring context: 2B                                                                                                                                                                                      0.0s
 => [internal] load metadata for docker.io/ampersandtarski/prototype-framework:v1.17                                                                                                                                 2.2s
 => [internal] load build context                                                                                                                                                                                    0.0s
 => => transferring context: 274B                                                                                                                                                                                    0.0s
 => CACHED [1/5] FROM docker.io/ampersandtarski/prototype-framework:v1.17@sha256:41be45987284d0ad511429c96d6b544ce1b747f85cb8ab159bbf24e7dd7d7eb1                                                                    0.0s
 => [2/5] COPY model /usr/local/project/                                                                                                                                                                             0.0s
 => [3/5] WORKDIR /usr/local/project                                                                                                                                                                                 0.0s
 => [4/5] RUN ampersand proto Switch_demo.adl   --proto-dir /var/www   --verbose                                                                                                                                    24.3s
 => ERROR [5/5] RUN chown -R www-data:www-data /var/www/log /var/www/data /var/www/generics  && cd /var/www                                                                                                          0.4s 
------                                                                                                                                                                                                                    
 > [5/5] RUN chown -R www-data:www-data /var/www/log /var/www/data /var/www/generics  && cd /var/www:                                                                                                                     
#0 0.363 chown: cannot access '/var/www/log': No such file or directory
------
failed to solve: executor failed running [/bin/sh -c chown -R www-data:www-data /var/www/log /var/www/data /var/www/generics  && cd /var/www]: exit code: 1
sjo00577@BA92-VYF9TXMD9G Switch_demo %

In the Dockerfile that I took from the repo project-template, I made two changes:

  1. I changed Script.adl to Switch_demo.adl
  2. I changed the version number of the prototype-framework to v1.17 (was v1.14) Here is the code of the Dockerfile as I ran it to produce the bug:
    
    FROM ampersandtarski/prototype-framework:v1.17

Lines to add specific compiler version (from Github releases)

ADD https://github.com/AmpersandTarski/Ampersand/releases/download/Ampersand-v4.1.0/ampersand /usr/local/bin/ampersand

RUN chmod +x /usr/local/bin/ampersand

Line to add specific compiler version (from Ampersand image)

COPY --from=ampersandtarski/ampersand:development /bin/ampersand /usr/local/bin

The script content

COPY model /usr/local/project/

If you have custom templates, they need to be copied to where the Ampersand compiler expects them (/var/www)

RUN cp -r -v /usr/local/project/shared/templates /var/www/

WORKDIR /usr/local/project

Generate prototype application from folder (you may want to include the option --ignore-invariant-violations)

RUN ampersand proto Switch_demo.adl \ --proto-dir /var/www \ --verbose

RUN chown -R www-data:www-data /var/www/log /var/www/data /var/www/generics \ && cd /var/www

uncomment lines below if customizations are added to default prototype framework

&& composer install --prefer-dist --no-dev --optimize-autoloader --profile \

&& npm install \

&& gulp build-ampersand \

&& gulp build-project


# What I expected
I expected this template to work in v1.17.
It works correctly in v1.14, which I tried out to verify.

# Version of ampersand that was used

# Steps to reproduce

1.
4.
5.
6.

# Screenshot / Video

# Context / Source of ampersand script
<!-- Optional: share your script if possible. It helps us reproduce the problem. Please try to keep the scripts tiny-->

<!-- We'd also love to know how you found the bug: #dogfooding, #manual-testing, #automated-testing, or #user-report if applicable.-->

<!-- If requesting a new feature, explain why you'd like to see it added.-->