-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
334 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/go/build-context-dockerignore/ | ||
|
||
**/.classpath | ||
**/.ddev | ||
**/.dockerignore | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/.next | ||
**/.cache | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/charts | ||
**/docker-compose* | ||
**/compose.y*ml | ||
!**/composer.json | ||
!**/composer.lock | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
**/vendor | ||
.editorconfig | ||
.gitattributes | ||
.prettierignore | ||
.prettierrc | ||
eslint.config.js | ||
phpstan.neon | ||
LICENSE | ||
README.md | ||
README.Docker.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM composer:lts as deps-composer-base | ||
WORKDIR /app | ||
COPY artisan /app/ | ||
COPY app /app/app/ | ||
COPY bootstrap /app/bootstrap/ | ||
COPY config /app/config/ | ||
COPY database /app/database/ | ||
COPY lang /app/lang/ | ||
COPY public /app/public/ | ||
COPY resources /app/resources/ | ||
COPY routes /app/routes/ | ||
COPY storage /app/storage/ | ||
|
||
FROM deps-composer-base as deps-composer-prod | ||
RUN --mount=type=bind,source=composer.json,target=composer.json \ | ||
--mount=type=bind,source=composer.lock,target=composer.lock \ | ||
--mount=type=cache,target=/tmp/cache \ | ||
composer install --no-interaction | ||
|
||
FROM deps-composer-base as deps-composer-dev | ||
RUN --mount=type=bind,source=composer.json,target=composer.json \ | ||
--mount=type=bind,source=composer.lock,target=composer.lock \ | ||
--mount=type=cache,target=/tmp/cache \ | ||
composer install --no-interaction | ||
|
||
FROM node:latest as deps-node-base | ||
WORKDIR /app | ||
COPY package.json /app/ | ||
COPY package-lock.json /app/ | ||
COPY vite.config.js /app/ | ||
COPY tailwind.config.js /app/ | ||
COPY postcss.config.js /app/ | ||
|
||
FROM deps-node-base as deps-node-prod | ||
COPY --from=deps-composer-prod /app /app | ||
RUN npm install --production | ||
RUN npm run build | ||
|
||
FROM deps-node-base as deps-node-dev | ||
COPY --from=deps-composer-dev /app /app | ||
RUN npm install | ||
RUN npm run build | ||
|
||
FROM php:8.3-apache as base | ||
RUN docker-php-ext-install pdo_mysql | ||
COPY .env /var/www/html/.env | ||
|
||
# This is for tinker | ||
RUN mkdir /var/www/.config && chown -R www-data:www-data /var/www/.config | ||
ENV APACHE_DOCUMENT_ROOT /var/www/html/public | ||
RUN sed -ri -e 's!/var/www/html!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/sites-available/*.conf | ||
RUN sed -ri -e 's!/var/www/!${APACHE_DOCUMENT_ROOT}!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf | ||
RUN a2enmod rewrite | ||
|
||
|
||
FROM base as prod | ||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" | ||
COPY --from=deps-composer-prod /app /var/www/html | ||
COPY --from=deps-node-prod /app /var/www/html | ||
COPY composer.json /var/www/html/composer.json | ||
RUN chown -R www-data:www-data /var/www/html | ||
USER www-data | ||
RUN php /var/www/html/artisan optimize | ||
RUN php /var/www/html/artisan config:cache | ||
|
||
FROM base as dev | ||
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini" | ||
COPY --from=deps-composer-dev /app /var/www/html | ||
COPY --from=deps-node-dev /app /var/www/html | ||
COPY composer.json /var/www/html/composer.json | ||
COPY tests /var/www/html/tests/ | ||
COPY phpunit.xml /var/www/html/phpunit.xml | ||
RUN chown -R www-data:www-data /var/www/html | ||
|
||
FROM prod as test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
### Building and running your application | ||
|
||
When you're ready, start your application by running: | ||
`docker compose up --build`. | ||
|
||
Your application will be available at http://localhost:1501. | ||
|
||
### PHP extensions | ||
If your application requires specific PHP extensions to run, they will need to be added to the Dockerfile. Follow the instructions and example in the Dockerfile to add them. | ||
|
||
### Deploying your application to the cloud | ||
|
||
First, build your image, e.g.: `docker build -t myapp .`. | ||
If your cloud uses a different CPU architecture than your development | ||
machine (e.g., you are on a Mac M1 and your cloud provider is amd64), | ||
you'll want to build the image for that platform, e.g.: | ||
`docker build --platform=linux/amd64 -t myapp .`. | ||
|
||
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`. | ||
|
||
Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/) | ||
docs for more detail on building and pushing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
services: | ||
mailpit: | ||
image: axllent/mailpit | ||
container_name: mailpit | ||
restart: unless-stopped | ||
volumes: | ||
- ./data:/data | ||
ports: | ||
- "8025:8025" | ||
- "1025:1025" | ||
depends_on: | ||
server: | ||
condition: service_started | ||
environment: | ||
MP_MAX_MESSAGES: 5000 | ||
MP_DATABASE: /data/mailpit.db | ||
MP_SMTP_AUTH_ACCEPT_ANY: 1 | ||
MP_SMTP_AUTH_ALLOW_INSECURE: 1 | ||
|
||
server: | ||
build: | ||
context: . | ||
secrets: | ||
- db-password | ||
target: dev | ||
extends: | ||
file: compose.yaml | ||
service: server | ||
|
||
db: | ||
environment: | ||
- MARIADB_DATABASES="db db_test" | ||
extends: | ||
file: compose.yaml | ||
service: db | ||
|
||
volumes: | ||
db-data: | ||
secrets: | ||
db-password: | ||
file: database/password.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
services: | ||
server-testing: | ||
build: | ||
context: . | ||
secrets: | ||
- db-password | ||
target: dev | ||
ports: | ||
- 1501:80 | ||
- 22:22 | ||
depends_on: | ||
db-testing: | ||
condition: service_healthy | ||
secrets: | ||
- db-password | ||
environment: | ||
- DB_PASSWORD_FILE=/run/secrets/db-password | ||
- DB_HOST=db-testing | ||
- DB_PORT=3306 | ||
- DB_DATABASE=db_test | ||
- DB_USERNAME=root | ||
- APP_ENV=testing | ||
- APP_MAINTENANCE_DRIVER=file | ||
- BCRYPT_ROUNDS=4 | ||
- CACHE_STORE=file | ||
- MAIL_MAILER=array | ||
- PULSE_ENABLED=false | ||
- QUEUE_CONNECTION=sync | ||
- SESSION_DRIVER=array | ||
- TELESCOPE_ENABLED=false | ||
env_file: | ||
- .env | ||
|
||
db-testing: | ||
image: mariadb | ||
restart: always | ||
user: root | ||
secrets: | ||
- db-password | ||
volumes: | ||
- db-data-testing:/var/lib/mysql | ||
environment: | ||
- MARIADB_ROOT_PASSWORD_FILE=/run/secrets/db-password | ||
- MARIADB_DATABASE=db_testing | ||
expose: | ||
- 3306 | ||
healthcheck: | ||
test: [ "CMD", "/usr/local/bin/healthcheck.sh", "--su-mysql", "--connect", "--innodb_initialized" ] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
volumes: | ||
db-data-testing: | ||
secrets: | ||
db-password: | ||
file: database/password.txt | ||
|
Oops, something went wrong.