Add missing files

This commit is contained in:
Adam Lavin 2021-03-27 03:58:08 +00:00
parent 16b9f33986
commit 79690f2edb
No known key found for this signature in database
GPG key ID: 9C4C68AFA9CA6461
4 changed files with 128 additions and 0 deletions

2
.dockerignore Normal file
View file

@ -0,0 +1,2 @@
node_modules/
vendor/

65
Dockerfile Normal file
View file

@ -0,0 +1,65 @@
FROM jrottenberg/ffmpeg:4.3-alpine312 as ffmpeg
FROM node:12-alpine as assets_builder
# To handle 'not get uid/gid'
RUN npm config set unsafe-perm true
RUN npm install -g gulp
WORKDIR /app
RUN mkdir -p /app/resources
COPY package.json /app
RUN npm install
COPY gulpfile.js /app
COPY webpack.base.config.js /app
COPY webpack.dev.config.js /app
COPY webpack.production.config.js /app
COPY resources /app/resources
RUN gulp build
FROM php:8.0-fpm-alpine
ENV LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64
COPY --from=ffmpeg /usr/local /usr/local
COPY --from=composer /usr/bin/composer /usr/bin/composer
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions
## Common libraries required for ffmpeg to work
RUN apk add --no-cache libgcc libstdc++ ca-certificates libcrypto1.1 libssl1.1 libgomp expat git
RUN apk add --no-cache nginx sudo
# Install php extensions
RUN install-php-extensions mysqli pgsql pdo_mysql pdo_pgsql gmp gmagick
RUN mkdir /app && chown -R www-data: /app
USER www-data
WORKDIR /app
COPY --chown=www-data composer.json /app
COPY --chown=www-data composer.lock /app
RUN composer install --no-scripts --no-autoloader --ignore-platform-reqs
COPY --chown=www-data --from=assets_builder /app /app
COPY --chown=www-data . /app
RUN composer dump-autoload -o
RUN php artisan optimize
USER root
# Remove files no longer needed on the host
RUN rm /usr/bin/composer /usr/bin/install-php-extensions
COPY docker/nginx/site.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
ENTRYPOINT ["docker/entrypoint.sh"]

13
Dockerfile.dev Normal file
View file

@ -0,0 +1,13 @@
FROM ponyfm
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions
RUN install-php-extensions xdebug
RUN echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_port=9001" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_handler=dbgp" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_connect_back=0" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.idekey=phpstorm" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
&& echo "xdebug.remote_host=docker.for.mac.localhost" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \

48
docker-compose.yml Normal file
View file

@ -0,0 +1,48 @@
version: "3.8"
services:
web:
image: ponyfm
container_name: web
ports:
- "8000:80"
links:
- elasticsearch
- postgresd
command:
- web
volumes:
- .:/app
- ./vagrant/php-overrides.ini:/usr/local/etc/php/conf.d/php.ini:ro
- ./vagrant/php-overrides.ini:/usr/local/etc/php-fpm.d/php.ini:ro
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.12.0
container_name: elasticsearch
environment:
- "discovery.type=single-node"
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data
ports:
- "9200:9200"
postgresd:
image: postgres:13.1-alpine
ports:
- "5432:5432"
environment:
- POSTGRES_USER=app
- POSTGRES_PASSWORD=secret
- POSTGRES_DB=app
volumes:
- postgres-data:/var/lib/postgresql/data
volumes:
postgres-data:
elasticsearch-data: