DEV Community

Pradeep Kumar
Pradeep Kumar

Posted on • Updated on

Connect Coolify (heroku alternative) with Gitlab (self-hosted) & Deploy Laravel using Dockerfile

Step 1: Connect Coolify with GitLab:

  • Login coolify dashboard
  • Click on Git Sources
  • Click on Add >
  • First enter the HTML URL, it the url where gitlab is hosted
  • Then enter API which is <gitlab-url>/api
  • Then Choose GitLab Application Type, it should be Instance-wide application (self-hosted)
  • Now, visit your <gitlab-url>/admin/applications and click on New Application. Enter the application name eg: coolify, in Redirect URI enter the Webhook URL from your coolify page: Screenshot

And choose api, read_respository, email then Click Save application.

On next page, you'll the the OAuth ID, Application ID & Secret:
Screenshot - OAuth ID

Once, this is done, we're ready to deploy the apps.

Step 2: Create a repository and clone

Step 3: Setup laravel

Step 4: Create a Dockerfile at the root of the project:

COPY . .
RUN composer install
CMD php artisan serve --host=
Enter fullscreen mode Exit fullscreen mode

Commit all the files.

Step 5: Point your domain to coolify ip.

To do this you need to add 2 A record from your domain control panel:

A     <project>
A     *.<project>
Enter fullscreen mode Exit fullscreen mode is your coolify server ip.

Step 6: Deploy Laravel

  • From coolify dashboard, click on Applications
  • Click on "+" icon and select source
  • Select your repository
  • Select the Destination
  • Select Docker at "Configure Build Pack" screen
  • Now, on General page, choose following options:
URL (FQDN): <project>
Port: 8000
Dockerfile Location: /Dockerfile
Base Directory: (keep the default value)
Enable Automatic Deployment: Enabled
Enable MR/PR Previews: Enableed
Debug Logs: Enabled
Enter fullscreen mode Exit fullscreen mode
  • Click Save and Click on Build Logs, after success build visit the url, you will be able to see the Laravel.

Top comments (0)