Browse Source

redo containerization

pull/3/head
Muhammad Sulaiman Yusuf 3 years ago
parent
commit
8ae348ce96
  1. 42
      Dockerfile
  2. 36
      docker-compose.yml
  3. 32
      docker/Dockerfile

42
Dockerfile

@ -0,0 +1,42 @@
FROM php:7.4-fpm-alpine
RUN apk add --update libzip-dev curl-dev &&\
docker-php-ext-install curl && \
apk del gcc g++ &&\
rm -rf /var/cache/apk/*
RUN apk add --no-cache \
zlib-dev \
icu-dev \
libpng-dev \
oniguruma-dev \
libpq-dev
RUN docker-php-ext-install \
curl \
mbstring \
intl \
pdo \
pdo_pgsql \
pgsql \
tokenizer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN rm -rf /var/cache/apk/*
WORKDIR /var/www
COPY composer.json composer.lock ./
COPY . .
RUN chmod +x artisan
RUN composer install
RUN composer dump-autoload --optimize
EXPOSE 80
CMD php -S 0.0.0.0:80

36
docker-compose.yml

@ -0,0 +1,36 @@
version: '3.8'
services:
lumen:
build:
context: .
dockerfile: Dockerfile
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
volumes:
- .:/var/www
networks:
- ospro
healthcheck:
test: curl --fail http://localhost || exit 1
interval: 60s
retries: 5
start_period: 20s
timeout: 10s
db:
image: postgres:14.4-alpine
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql/data
networks:
ospro:
driver: bridge
volumes:
db:
driver: local

32
docker/Dockerfile

@ -1,32 +0,0 @@
FROM php:7.4-fpm-alpine
RUN apk add --update --no-cache
RUN apk add \
libpq-dev \
php7-tokenizer \
php7-zip \
php7-curl \
php7-mbstring \
php7-intl \
php7-iconv
RUN docker-php-ext-install pgsql pdo_pgsql
#RUN curl -sS https://getcomposer.org/installer | php -- \
# --install-dir=/usr/bin --filename=composer
ADD https://getcomposer.org/installer ./composer-setup.php
RUN php ./composer-setup.php --install-dir=/usr/local/bin --filename=composer
RUN rm ./composer-setup.php
RUN rm -rf /var/cache/apk/*
COPY . /kit-api
RUN cd "/kit-api" && cp .env.production .env && composer install
WORKDIR /kit-api
EXPOSE 80
CMD php -S 0.0.0.0:80
Loading…
Cancel
Save