Skip to content

Commit 192a0eb

Browse files
committed
Initial commit
0 parents  commit 192a0eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+11617
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
.env

development/.env.example

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Sync user ID and group ID to avoid permission issues
2+
UID=1000 # Replace with your user ID
3+
GID=1000 # Replace with your group ID
4+
5+
# Path to your Laravel application
6+
LARAVEL_APP_PATH=/absolute/path/to/your-laravel-app
7+
8+
# Nginx configuration
9+
# The host where Nginx will be accessible.
10+
NGINX_HOST=localhost
11+
12+
# The port on which Nginx will listen. Typically, this would be port 80.
13+
NGINX_PORT=80
14+
15+
# PostgreSQL database configuration
16+
# The name of the database to be used by your Laravel application.
17+
DB_DATABASE=laravel
18+
19+
# The username for accessing the PostgreSQL database.
20+
DB_USERNAME=laravel
21+
22+
# The password for accessing the PostgreSQL database.
23+
DB_PASSWORD=secret

development/compose.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
services:
2+
web:
3+
image: nginx:latest # We don't need to customize the image. Just pass the configuration to the Dockerfile.
4+
networks:
5+
- laravel
6+
volumes:
7+
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro # Mount the nginx.conf file directly
8+
- ${LARAVEL_APP_PATH}:/var/www
9+
ports:
10+
- "${NGINX_PORT}:80"
11+
environment:
12+
- NGINX_HOST=${NGINX_HOST}
13+
14+
php-fpm:
15+
# For the php-fpm service, we will create a custom image to install the necessary PHP extensions and setup proper permissions.
16+
build:
17+
context: ./php-fpm
18+
dockerfile: Dockerfile
19+
args:
20+
UID: ${UID}
21+
GID: ${GID}
22+
volumes:
23+
- ${LARAVEL_APP_PATH}:/var/www
24+
networks:
25+
- laravel
26+
27+
workspace:
28+
# For the workspace service, we will also create a custom image to install and setup all the necessary stuff.
29+
build:
30+
context: ./workspace
31+
dockerfile: Dockerfile
32+
args:
33+
UID: ${UID}
34+
GID: ${GID}
35+
tty: true # Keep the terminal open
36+
stdin_open: true # Keep stdin open to attach to the container
37+
volumes:
38+
- ${LARAVEL_APP_PATH}:/var/www
39+
networks:
40+
- laravel
41+
42+
postgres:
43+
image: postgres:16
44+
ports:
45+
- "5432:5432"
46+
environment:
47+
- POSTGRES_DB=${DB_DATABASE}
48+
- POSTGRES_USER=${DB_USERNAME}
49+
- POSTGRES_PASSWORD=${DB_PASSWORD}
50+
volumes:
51+
- postgres-data:/var/lib/postgresql/data
52+
networks:
53+
- laravel
54+
55+
redis:
56+
image: redis:alpine
57+
networks:
58+
- laravel
59+
60+
networks:
61+
laravel:
62+
63+
volumes:
64+
postgres-data:

development/nginx/nginx.conf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
events {
2+
worker_connections 1024;
3+
}
4+
5+
http {
6+
include /etc/nginx/mime.types;
7+
default_type application/octet-stream;
8+
9+
sendfile on;
10+
keepalive_timeout 65;
11+
12+
server {
13+
listen 80;
14+
server_name localhost;
15+
16+
root /var/www/public;
17+
index index.php index.html;
18+
19+
location / {
20+
try_files $uri $uri/ /index.php?$query_string;
21+
}
22+
23+
location ~ \.php$ {
24+
fastcgi_pass php-fpm:9000;
25+
fastcgi_index index.php;
26+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
27+
include fastcgi_params;
28+
}
29+
}
30+
}

development/php-fpm/Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Stage 1: Build environment
2+
FROM php:8.3-fpm AS builder
3+
4+
# Install system dependencies and build libraries
5+
RUN apt-get update && apt-get install -y --no-install-recommends \
6+
curl \
7+
# libpq-dev is required for PostgreSQL
8+
libpq-dev \
9+
libonig-dev \
10+
libssl-dev \
11+
libxml2-dev \
12+
libcurl4-openssl-dev \
13+
&& docker-php-ext-install -j$(nproc) \
14+
# PHP Extensions required for Laravel. See https://laravel.com/docs/11.x/deployment#server-requirements
15+
# Most of these extensions are already included in the base image.
16+
pdo_pgsql \
17+
pgsql \
18+
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
19+
20+
# Stage 2: Runtime environment
21+
FROM php:8.3-fpm
22+
23+
# Set environment variables for user and group ID
24+
ARG UID=1000
25+
ARG GID=1000
26+
27+
# Create a user with the same UID and GID as the host user
28+
RUN groupadd -g ${GID} www && \
29+
useradd -u ${UID} -g www -m www
30+
31+
# Copy only the necessary PHP extensions from the build stage
32+
COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-*/ /usr/local/lib/php/extensions/no-debug-non-zts-*/
33+
34+
# Set working directory
35+
WORKDIR /var/www
36+
37+
# Change ownership of the working directory to the new user
38+
RUN chown -R www:www /var/www
39+
40+
# Switch to the non-root user
41+
USER www
42+
43+
# Expose port 9000 and start php-fpm server
44+
EXPOSE 9000
45+
CMD ["php-fpm"]

development/workspace/Dockerfile

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Use the official PHP CLI image as the base
2+
FROM php:8.3-cli
3+
4+
# Set environment variables for user and group ID
5+
ARG UID=1000
6+
ARG GID=1000
7+
ARG NODE_VERSION=22.0.0
8+
9+
# Install system dependencies and build libraries
10+
RUN apt-get update && apt-get install -y \
11+
curl \
12+
git \
13+
sudo \
14+
libpq-dev \
15+
libonig-dev \
16+
libssl-dev \
17+
libxml2-dev \
18+
libcurl4-openssl-dev \
19+
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
20+
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash \
21+
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
22+
23+
# Create a user with the same UID and GID as the host user
24+
RUN groupadd -g ${GID} www && \
25+
useradd -u ${UID} -g www -m www && \
26+
usermod -aG sudo www && \
27+
echo 'www ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
28+
chown -R www:www /home/www
29+
30+
# Switch to the non-root user to install NVM and Node.js
31+
USER www
32+
33+
# Install NVM as the www user
34+
RUN export NVM_DIR="$HOME/.nvm" && \
35+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash && \
36+
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \
37+
nvm install ${NODE_VERSION} && \
38+
nvm alias default ${NODE_VERSION} && \
39+
nvm use default
40+
41+
# Ensure NVM is available for all future shells
42+
RUN echo 'export NVM_DIR="$HOME/.nvm"' >> /home/www/.bashrc && \
43+
echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> /home/www/.bashrc && \
44+
echo '[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"' >> /home/www/.bashrc
45+
46+
# Set the working directory
47+
WORKDIR /var/www
48+
49+
# Override the entrypoint to avoid the default php entrypoint
50+
ENTRYPOINT []
51+
52+
# Default command to keep the container running
53+
CMD ["bash"]

example-app/.DS_Store

8 KB
Binary file not shown.

example-app/.dockerignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Include any files or directories that you don't want to be copied to your
2+
# container here (e.g., local build artifacts, temporary files, etc.).
3+
#
4+
# For more help, visit the .dockerignore file reference guide at
5+
# https://docs.docker.com/go/build-context-dockerignore/
6+
7+
**/.classpath
8+
**/.dockerignore
9+
**/.env
10+
**/.git
11+
**/.gitignore
12+
**/.project
13+
**/.settings
14+
**/.toolstarget
15+
**/.vs
16+
**/.vscode
17+
**/.next
18+
**/.cache
19+
**/*.*proj.user
20+
**/*.dbmdl
21+
**/*.jfm
22+
**/charts
23+
**/docker-compose*
24+
**/compose.y*ml
25+
!**/composer.json
26+
!**/composer.lock
27+
**/Dockerfile*
28+
**/node_modules
29+
**/npm-debug.log
30+
**/obj
31+
**/secrets.dev.yaml
32+
**/values.dev.yaml
33+
**/vendor
34+
LICENSE
35+
README.md

example-app/.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = space
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2
16+
17+
[docker-compose.yml]
18+
indent_size = 4

example-app/.env.example

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
APP_NAME=Laravel
2+
APP_ENV=local
3+
APP_KEY=
4+
APP_DEBUG=true
5+
APP_TIMEZONE=UTC
6+
APP_URL=http://localhost
7+
8+
APP_LOCALE=en
9+
APP_FALLBACK_LOCALE=en
10+
APP_FAKER_LOCALE=en_US
11+
12+
APP_MAINTENANCE_DRIVER=file
13+
# APP_MAINTENANCE_STORE=database
14+
15+
BCRYPT_ROUNDS=12
16+
17+
LOG_CHANNEL=stack
18+
LOG_STACK=single
19+
LOG_DEPRECATIONS_CHANNEL=null
20+
LOG_LEVEL=debug
21+
22+
DB_CONNECTION=sqlite
23+
# DB_HOST=127.0.0.1
24+
# DB_PORT=3306
25+
# DB_DATABASE=laravel
26+
# DB_USERNAME=root
27+
# DB_PASSWORD=
28+
29+
SESSION_DRIVER=database
30+
SESSION_LIFETIME=120
31+
SESSION_ENCRYPT=false
32+
SESSION_PATH=/
33+
SESSION_DOMAIN=null
34+
35+
BROADCAST_CONNECTION=log
36+
FILESYSTEM_DISK=local
37+
QUEUE_CONNECTION=database
38+
39+
CACHE_STORE=database
40+
CACHE_PREFIX=
41+
42+
MEMCACHED_HOST=127.0.0.1
43+
44+
REDIS_CLIENT=phpredis
45+
REDIS_HOST=127.0.0.1
46+
REDIS_PASSWORD=null
47+
REDIS_PORT=6379
48+
49+
MAIL_MAILER=log
50+
MAIL_HOST=127.0.0.1
51+
MAIL_PORT=2525
52+
MAIL_USERNAME=null
53+
MAIL_PASSWORD=null
54+
MAIL_ENCRYPTION=null
55+
MAIL_FROM_ADDRESS="[email protected]"
56+
MAIL_FROM_NAME="${APP_NAME}"
57+
58+
AWS_ACCESS_KEY_ID=
59+
AWS_SECRET_ACCESS_KEY=
60+
AWS_DEFAULT_REGION=us-east-1
61+
AWS_BUCKET=
62+
AWS_USE_PATH_STYLE_ENDPOINT=false
63+
64+
VITE_APP_NAME="${APP_NAME}"

0 commit comments

Comments
 (0)