mirror of https://github.com/kcal-app/kcal.git
Create initial Dockerfile and config
This commit is contained in:
parent
aea8c66f5d
commit
0eba6a4000
|
@ -3,6 +3,8 @@ APP_ENV=production
|
|||
APP_KEY=
|
||||
APP_DEBUG=false
|
||||
APP_URL=
|
||||
APP_PORT=80
|
||||
APP_PORT_SSL=443
|
||||
APP_TIMEZONE=UTC
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
/vendor
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
docker-compose.yml
|
||||
docker-compose.override.yml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
FROM php:8.0-fpm-alpine
|
||||
|
||||
RUN apk add --no-cache --virtual \
|
||||
.build-deps \
|
||||
$PHPIZE_DEPS \
|
||||
bash \
|
||||
freetype-dev \
|
||||
git \
|
||||
icu-dev \
|
||||
icu-libs \
|
||||
libjpeg-turbo-dev \
|
||||
libpng-dev \
|
||||
libzip-dev \
|
||||
mysql-client \
|
||||
oniguruma-dev \
|
||||
openssh-client \
|
||||
openssl \
|
||||
postgresql-dev \
|
||||
rsync \
|
||||
zlib-dev
|
||||
|
||||
# Configure php extensions.
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg
|
||||
|
||||
# Install php extensions.
|
||||
RUN docker-php-ext-install \
|
||||
bcmath \
|
||||
calendar \
|
||||
exif \
|
||||
gd \
|
||||
intl \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pcntl \
|
||||
zip
|
||||
|
||||
# Install composer.
|
||||
ENV COMPOSER_HOME /composer
|
||||
ENV PATH ./vendor/bin:/composer/vendor/bin:$PATH
|
||||
ENV COMPOSER_ALLOW_SUPERUSER 1
|
||||
RUN curl -s https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer
|
||||
|
||||
# Add user and group.
|
||||
RUN addgroup -S -g 1000 www
|
||||
RUN adduser -S -u 1000 -s /bin/bash -G www www
|
||||
|
||||
# Setup working directory.
|
||||
WORKDIR /app
|
||||
COPY --chown=www:www . /app
|
||||
|
||||
# Install dependencies.
|
||||
RUN composer install --optimize-autoloader --no-dev
|
||||
|
||||
# Change current user to www.
|
||||
USER www
|
||||
|
||||
# Optimize application.
|
||||
RUN php artisan config:cache
|
||||
RUN php artisan route:cache
|
||||
RUN php artisan view:cache
|
||||
|
||||
# Expose port 9000 and start php-fpm server.
|
||||
EXPOSE 9000
|
||||
CMD ["php-fpm"]
|
|
@ -0,0 +1,88 @@
|
|||
version: '3'
|
||||
services:
|
||||
app:
|
||||
image: kcalapp/kcal
|
||||
container_name: kcal-app
|
||||
restart: unless-stopped
|
||||
tty: true
|
||||
working_dir: /var/www
|
||||
volumes:
|
||||
- ./:/var/www
|
||||
- ./etc/php/php.ini:/usr/local/etc/php/conf.d/local.ini
|
||||
networks:
|
||||
- kcal
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
- elasticsearch
|
||||
webserver:
|
||||
image: nginx:alpine
|
||||
container_name: kcal-nginx
|
||||
restart: unless-stopped
|
||||
tty: true
|
||||
ports:
|
||||
- '${APP_PORT:-80}:80'
|
||||
- '${APP_PORT_SSL:-443}:443'
|
||||
volumes:
|
||||
- ./:/var/www
|
||||
- ./etc/nginx/conf.d/:/etc/nginx/conf.d/
|
||||
networks:
|
||||
- kcal
|
||||
db:
|
||||
image: mysql:8.0
|
||||
container_name: kcal-db
|
||||
restart: unless-stopped
|
||||
tty: true
|
||||
ports:
|
||||
- '${DB_PORT:-3306}:3306'
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD:-kcal}'
|
||||
MYSQL_DATABASE: '${DB_DATABASE:-kcal}'
|
||||
MYSQL_USER: '${DB_USERNAME:-kcal}'
|
||||
MYSQL_PASSWORD: '${DB_PASSWORD:-kcal}'
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
|
||||
volumes:
|
||||
- db-data:/var/lib/mysql/
|
||||
- ./etc/mysql/my.cnf:/etc/mysql/my.cnf
|
||||
networks:
|
||||
- kcal
|
||||
elasticsearch:
|
||||
image: 'elasticsearch:7.12.0'
|
||||
container_name: kcal-elasticsearch
|
||||
environment:
|
||||
- xpack.security.enabled=false
|
||||
- discovery.type=single-node
|
||||
ulimits:
|
||||
memlock:
|
||||
soft: -1
|
||||
hard: -1
|
||||
nofile:
|
||||
soft: 65536
|
||||
hard: 65536
|
||||
cap_add:
|
||||
- IPC_LOCK
|
||||
volumes:
|
||||
- elasticsearch-data:/usr/share/elasticsearch/data
|
||||
ports:
|
||||
- '${ELASTIC_PORT:-9200}:9200'
|
||||
networks:
|
||||
- kcal
|
||||
redis:
|
||||
image: 'redis:alpine'
|
||||
container_name: kcal-redis
|
||||
ports:
|
||||
- '${REDIS_PORT:-6379}:6379'
|
||||
volumes:
|
||||
- 'redis-data:/data'
|
||||
networks:
|
||||
- kcal
|
||||
networks:
|
||||
kcal:
|
||||
driver: bridge
|
||||
volumes:
|
||||
db-data:
|
||||
driver: local
|
||||
elasticsearch-data:
|
||||
driver: local
|
||||
redis-data:
|
||||
driver: local
|
|
@ -0,0 +1,4 @@
|
|||
[mysqld]
|
||||
general_log = 1
|
||||
general_log_file = /var/lib/mysql/general.log
|
||||
secure-file-priv=NULL
|
|
@ -0,0 +1,20 @@
|
|||
server {
|
||||
listen 80;
|
||||
index index.php index.html;
|
||||
error_log /var/log/nginx/error.log;
|
||||
access_log /var/log/nginx/access.log;
|
||||
root /var/www/public;
|
||||
location ~ \.php$ {
|
||||
try_files $uri =404;
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass app:9000;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||
}
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
gzip_static on;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
upload_max_filesize=40M
|
||||
post_max_size=40M
|
Loading…
Reference in New Issue