Skip to content

incodemode/laravel-dockerfile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Dockerfile for Laravel 11 with apache

Description

Dockerfile to load laravel with apache2, this was used for quickly grading students projects so it is not production ready.

Introduction

  • This is meant to be used with a clean clone not installed in your local, that would be a little different.
  • So after doing a git clone somthingGithubsomehing/example-app example-app
  • and cd example-app you would be able to follow the instructions
  • you can download docker desktop from (https://www.docker.com/products/docker-desktop/)

Instructions

  • Copy Dockefile and laravel-apache.conf to your clean cloned project folder.
  • Add normal .env
  • Database in .env for mariadb must use mysql connector and the ip of your local gotten with ipconfig (Ethernet adapter vEthernet (WSL)):
DB_HOST=172.18.208.1 
DB_CONNECTION=mysql
  • Build image:
    docker build -t laravel .
  • To use the image:
    docker run -p 8081:80 laravel
  • Add to your hosts file:
    127.0.0.1 docker.localhost
  • Access via http://docker.localhost:8081/

Extra instructions

  • You can get the hexa for the running docker with:
    cmd docker ps |findstr laravel
    bash docker ps |grep laravel
    something like this should be returned:
    3263be5f1ae8 laravel "docker-php-entrypoi???" 46 minutes ago Up 46 minutes 0.0.0.0:8081->80/tcp wizardly_matsumoto
    the hexa would be 3263be5f1ae8
  • kill container:
    docker kill <hexa_of_container>
  • bash in the container:
    docker exec -it <hexa_of_container> bash

Code is free to use and modify but not production ready, use at your own peril.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published