Skip to content

Commit

Permalink
Update Dockerfile and docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
flemming-pr committed Jan 4, 2024
1 parent 3d0a3b8 commit be6d4eb
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 55 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.yml]
indent_style = space
indent_size = 2
66 changes: 66 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#Laravel Backend
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

# Database
MYSQL_RANDOM_ROOT_PASSWORD=true
MYSQL_DATABASE=databse
MYSQL_USER=secret
MYSQL_PASSWORD=secret
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.env
frontend/.env
backend/.env
41 changes: 16 additions & 25 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,44 +5,35 @@ RUN mkdir -p /var/www/html/databasestore

WORKDIR /var/www/html

# Install Composer manually
COPY --from=composer/composer:latest-bin /composer /usr/bin/composer

RUN apk add --no-cache \
npm

COPY ./ /var/www/html

RUN composer install --optimize-autoloader --no-interaction --no-dev --ignore-platform-req=ext-intl

FROM unit:php8.2
FROM dunglas/frankenphp

RUN mkdir -p /var/www/html
RUN mkdir -p /var/www/html/databasestore
RUN mkdir -p /app/public/databasestore

WORKDIR /var/www/html
WORKDIR /app/public

COPY --from=build --chown=unit:unit /var/www/html /var/www/html
COPY --from=build /var/www/html /app/public

ENV TZ=Europe/Berlin

# Update package lists and install required dependencies
RUN apt-get update && apt-get install -y \
libicu-dev \
libjpeg-dev \
libpng-dev \
libfreetype6-dev \
sudo \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install and enable the intl and gd extensions
RUN docker-php-ext-install intl gd

COPY docker/config.json /docker-entrypoint.d/config.json
RUN apt-get update && \
apt-get install -y netcat-traditional && \
rm -rf /var/lib/apt/lists/*

COPY docker/entrypoint.sh /docker-entrypoint.d/entrypoint.sh
RUN install-php-extensions \
pdo_mysql \
gd \
intl \
zip \
opcache

RUN chmod +x /docker-entrypoint.d/entrypoint.sh
RUN chmod +x /app/public/docker/entrypoint.sh

EXPOSE 80
ENTRYPOINT ["/app/public/docker/entrypoint.sh"]
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]
30 changes: 0 additions & 30 deletions backend/docker/config.json

This file was deleted.

17 changes: 17 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ services:
options:
max-size: "10m"

database:
image: mysql:8.0
volumes:
- mysql:/var/lib/mysql:cached
networks:
- stack
ports:
- 127.0.0.1:3306:3306
env_file:
- .env
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci --sql_mode=''
logging:
options:
max-size: "10m"
max-file: "3"
restart: always

frontend:
image: ghcr.io/chaostreff-flensburg/pretty-good-proposal/frontend:latest
restart: always
Expand Down

0 comments on commit be6d4eb

Please sign in to comment.