Skip to content

Codespace #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 0 additions & 71 deletions .devcontainer/.docker/php/Dockerfile

This file was deleted.

28 changes: 0 additions & 28 deletions .devcontainer/.env

This file was deleted.

33 changes: 1 addition & 32 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,6 @@
{
"name": "laravel-fresh-install",

// Mandatory definition for .devcontainer
//
// which service AS DEFINED IN .devcontainer/docker-compose.yml
// do we want VS Code to attach to?
// here, we choose the "php" service since that's where our code is executed
"service": "php",

// we have multiple containers (nginx, PHP, MySQL, redis)
// so we'll use a compose .yml file instead of defining the services in devcontainer.json
"dockerComposeFile": "./docker-compose.yml",

"shutdownAction": "stopCompose",

// Mandatory definition for .devcontainer
//
// workspaceFolder describes the CONTAINER folder
// in which the "service" (php here) is configured to mount the project
// in our case, "/var/www/htdoc" refers to
// ${WEBROOT_HOST_PATH}:${WEBROOT_CONTAINER_PATH} in our "php" service "volumeS"
// these are defined in .devcontainer/.env as follows:
// WEBROOT_HOST_PATH=../src
// WEBROOT_CONTAINER_PATH=/var/www/htdoc
"workspaceFolder": "/var/www/htdoc",

// NOT REQUIRED, because our mounts are defined in the .yml file
//
// mount defined in docker-compose.yml
//"mounts": [
// "source=${localWorkspaceFolder},target=/src,type=bind"
//],

// "xdebug.php-debug" = official XDEBUG extension
"customizations": {
"vscode": {
Expand All @@ -45,4 +14,4 @@

// execute our one-time repo init if /vendor/ does not exist
"postCreateCommand": "sh init_repo.sh"
}
}
84 changes: 0 additions & 84 deletions .devcontainer/docker-compose.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# defined in docker-compose.yml, from docker-env.env
ARG RUNTIME_PHP_IMAGE

# Use the specified image as the base
FROM ${RUNTIME_PHP_IMAGE}

# Install system dependencies and PHP extensions
RUN apt-get update && apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev zip git unzip && \
docker-php-ext-configure gd --with-freetype --with-jpeg && \
docker-php-ext-install gd pdo pdo_mysql

# Test if already installed and
# install the <latest> mongodb PHP extension
# RUN pecl install mongodb && docker-php-ext-enable mongodb
RUN bash -c '[[ -n "$(pecl list | grep mongodb)" ]]\
|| (pecl install mongodb && docker-php-ext-enable mongodb)'

# Test if already installed and
# install and enable XDEBUG <latest>
# RUN pecl install xdebug && docker-php-ext-enable xdebug
RUN bash -c '[[ -n "$(pecl list | grep xdebug)" ]]\
|| (pecl install xdebug && docker-php-ext-enable xdebug)'
# Get Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/htdoc
File renamed without changes.
File renamed without changes.
62 changes: 62 additions & 0 deletions .framework/php/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# build command: docker compose build
# docker uses the .env file BY DEFAULT. Any other name and you'll have to specify it in the command line
# docker compose --env-file FILENAME.env build

# docker compose version
version: '3.4'

# Services
services:

# Nginx Service
nginx:

image: nginx:alpine
ports:
- 80:80
volumes:
- ./src:/var/www/htdoc
- ./.docker/nginx/conf.d:/etc/nginx/conf.d
depends_on:
- php
- mysql_service

# PHP Service
php:
build:
context: ./.docker/php
dockerfile: Dockerfile
args:
RUNTIME_PHP_IMAGE: php:8.2-fpm
image: php:8.2-fpm
# container-path
working_dir: /var/www/htdoc
volumes:
- ./src:/var/www/htdoc
environment:
- DATABASE_URL=mysql://root:rootpassword@mysql_service:3306/mydatabase
depends_on:
- mysql_service



# MySQL Service
mysql_service:
image: mysql:5.7

environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: mydatabase


# redis:
# image: redis:latest
# ports:
# - "6379:6379"
# volumes:
# - ${REDIS_DATA_HOST_PATH}:${REDIS_DATA_CONTAINER_PATH}

# Notes:
#
# From Docker Compose version 3.4 the name of the volume can be dynamically generated from environment variables placed in an .env file (this file has to be in the same folder as docker-compose.yml is).
#