R

Railway

βœ‹ο½œhelp

Join Server

Build from Dockerfile doesn't start

Ssheffik5/23/2023
Hey. Hey,
I've been struggling with this for over 8 hours, so far I can't deploy my Laravel/Svelte/Inertia application anywhere. At first I wanted to use docker-compose.yml and host it on Azure, after failing to set it up I reverted to just Dockerfile and Railway. Unfortunately, when I try to build the application and deploy to Railway, the build just won't start, even though Railway found my dockerfile. Does anyone have any idea why this isn't working?

Dockerfile
# We use the official PHP image with Apache
FROM php:8.1-apache

# Install the necessary tools and extensions
RUN apt-get update && apt-get install -y \
    git \
    unzip \
    libzip-dev \
    && docker-php-ext-install zip

# Install the necessary PHP extension
RUN docker-php-ext-install pdo_mysql

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Activate mod_rewrite for Apache
RUN a2enmod rewrite

# Set up the working directory
WORKDIR /var/www/html

# Copy Composer dependencies
COPY composer.json composer.lock ./

# Install Composer dependencies
RUN composer install --no-scripts --no-autoloader --no-dev --prefer-dist

# Copy the NPM dependencies
COPY package.json ./

# Install NPM dependencies
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -
RUN apt-get install -y nodejs
RUN npm install

# Copy the rest of the application
COPY . .

# Generate the autoloader and start the migration
RUN composer dump-autoload --optimize

# Build the frontend
RUN npm run prod

# Set permissions
RUN chown -R www-data:www-data /var/www/html

# Set Apache DocumentRoot to Laravel's public directory
RUN sed -i 's!/var/www/html!/var/www/html/public!g' /etc/apache2/sites-available/000-default.conf

# Expose port 80
EXPOSE 80


Lots of love
Luka
Ssheffik5/23/2023
155248f7-afe3-42dd-a929-db4f95caa1b6
Ssaintcore5/23/2023
Ssheffik5/23/2023
I see, guess I'll have to wait to be sure haha.
Ssaintcore5/23/2023
I do think there is more going on under the hood then just a delay in logs-visibility. There are plenty users reporting that their (once working) deploys are failing since today (including myself) without any changes to their code^^
Ssaintcore5/23/2023
@sheffik The build logs error should be fixed and at least for me my build error has also somehow magically gone away πŸ˜„
Ssheffik5/23/2023
I'll check it out! Thanks
Ssheffik5/23/2023
Ssheffik5/23/2023
sadly nothing yet
Ssheffik5/23/2023
nvm something is happening
Ssheffik5/23/2023
just took a long time
Ssaintcore5/23/2023
Wait a few seconds/minutes, there seems to be a delay with displaying them. In my case my deployment (build) was already running for 2mins until logs were showing up
Ssaintcore5/23/2023
yep πŸ˜„
Ssheffik5/23/2023
yeah I guess it works now
Ssheffik5/23/2023
another problem popped up tho haha
Ssheffik5/23/2023
but I guess that's on my side
ADA Dumb5/23/2023
Looks like you've got it, but I do want to note that docker compose is not supported by Railway atm
Ssheffik5/23/2023
As a guy who does mainly React/Nuxt, I would've never guessed that deploying a web app could take this long lmao
ADA Dumb5/23/2023
it requires persistent storage, which Railway does not support
Ssheffik5/23/2023
I am not using docker-compose tho
ADA Dumb5/23/2023
You were, you said so in your first message
ADA Dumb5/23/2023
just wanted to clear that up
Ssheffik5/23/2023
Yeah, I switched up back to just docker, cause I wanted to deploy on railway
Ssheffik5/23/2023
but I honestly can't wrap my head around this
Ssaintcore5/23/2023
Hmm I'm wondering why you do build the docker image (if using nuxt for example) by yourself? IMHO Railway does a great job when letting them handle this step for you. At least for me (but I'm working at the backend part and almost all my projects are running with strapi)
Ssheffik5/23/2023
I am building a Laravel/Svelte app
Ssheffik5/23/2023
this is a nightmare tbh haha
Ssheffik5/23/2023
I got rid of the previous error
Ssheffik5/23/2023
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.203. Set the 'ServerName' directive globally to suppress this message
Ssheffik5/23/2023
this is the last thing standing in my path I guess
Bbrody5/23/2023
like saintcore said, why not let nixpacks build your app?