[QUESTION] Laravel + inertial + vuejs
What happened?
Hi, I am using Laravel + Inertia + Vuejs, below is my dockerfile.
My questions:
- Is it okay to install other packages like composer, nvm, supervisor, etc in 1 Dockerfile with the frankenphp image?
- How can I run npm run dev or npm run build, when I spin a container so that I will not exec to the container just to run the command npm run dev or npm run build?
FROM dunglas/frankenphp:latest
# Add additional PHP extensions here:
RUN install-php-extensions \
pdo_mysql \
gd \
intl \
zip \
opcache \
curl
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
// Installing some other packages here like NVM , supervisor, etc...
COPY . /app
RUN npm install
Thank you in advance.
WORKDIR /app
Build Type
Official static build
Worker Mode
No
Operating System
Other (tell us more in the description)
CPU Architecture
x86_64
PHP configuration
not relevant to my question
Relevant log output
No response
-
i think install composer and some dev dependencies while you are in dev process its ok, you can skip these tools in production using multi-stage docker builds
-
you can achieve this in two ways: 2.1 - creating a .sh file, add these commands in the .sh file and at the end of the file you call frankenphp command and change your dockerfile entrypoint to use these sh script. 2.2 - using a caddy module, like i did in this repository take a look at these files: Dockerfile and octane.Caddyfile
made the same question in this issue.
nb: i don't know if this way is the right nor best way "but works"
I'm still think this could be as default in frankenphp the possibility to have a "entrypoints folder" that will be ran before the application is booted up
@sneycampos Thank you for the reply, I will check on those links