Skip to content
Snippets Groups Projects
Commit 241fa00e authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

fix composer deployment

parent 69a14923
No related branches found
No related tags found
No related merge requests found
.env 0 → 100644
ENVIRONMENT=development # Environment to deploy to. Can be: development|production
USER=1000 # User ID used in the Docker containers
GROUP=1000 # Group ID used in the Docker containers
IMAGE_TAG=latest
\ No newline at end of file
ls
php artisan version
*
!.gitignore
File moved
FROM alpine:3.18.4 as base
FROM alpine:3.13 as base
ARG USER=1000
ARG GROUP=1000
RUN apk add --update \
tzdata \
ca-certificates \
zip \
redis \
php81 \
php81-fpm \
php81-xdebug \
php7 \
php7-common \
php7-phar \
php7-fpm \
php7-curl \
php7-mbstring \
php7-sqlite3 \
php7-pdo_mysql \
php7-pdo_sqlite \
php7-dom \
php7-xml \
php7-xmlwriter \
php7-tokenizer \
php7-zip \
php7-redis \
php7-gd \
php7-json \
php7-pcntl \
php7-fileinfo \
php7-xdebug \
&& rm -rf /var/cache/apk/*
RUN cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime
RUN adduser mgmaps -h /html -D -s /bin/sh -k /dev/null
RUN addgroup -g $GROUP mgmaps && adduser mgmaps -h /mgmaps -D -s /bin/sh -k /dev/null -u $USER -G mgmaps
USER mgmaps
WORKDIR /html
RUN mkdir -p /html/vendor /html/bootstrap/cache /mgmaps/.composer
EXPOSE 80
FROM base as composer
USER root
WORKDIR /mgmaps
ADD ./build/fpm/installComposer.sh /usr/bin/installComposer
RUN chmod go+x /usr/bin/installComposer
RUN installComposer && rm /usr/bin/installComposer
USER mgmaps
WORKDIR /html
VOLUME ["/mgmaps/.composer", "/html/vendor", "/html/bootstrap/cache"]
CMD ["composer", "install"]
FROM base as development
USER root
# Add common configurations development & production
ADD ./build/fpm/configuration/common/*.ini /etc/php81/conf.d/
ADD ./build/fpm/configuration/common/*.conf /etc/php81/php-fpm.d/
ADD ./build/fpm/configuration/common/*.ini /etc/php7/conf.d/
ADD ./build/fpm/configuration/common/*.conf /etc/php7/php-fpm.d/
# Add development only configuration
ADD ./build/fpm/configuration/development/*.ini /etc/php81/conf.d/
ADD ./build/fpm/configuration/development/*.conf /etc/php81/php-fpm.d/
ADD ./build/fpm/configuration/development/*.ini /etc/php7/conf.d/
ADD ./build/fpm/configuration/development/*.conf /etc/php7/php-fpm.d/
ADD ./build/fpm/entrypoint.sh /entrypoint.sh
RUN chmod ug+x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
CMD php-fpm81 --nodaemonize
CMD ["php-fpm7", "--nodaemonize"]
USER mgmaps
VOLUME ["/html/vendor", "/html/bootstrap/cache"]
FROM development as production
USER root
RUN apk del php81-xdebug
RUN rm /etc/php81/conf.d/xdebug.ini
RUN apk del php7-xdebug
RUN rm /etc/php7/conf.d/xdebug.ini
USER mgmaps
......
#! /bin/sh
_term() {
echo "Stopping Process!"
kill -TERM "$fpm" 2>/dev/null
}
trap _term SIGTERM
cd ~
if [ ! -f .env ]
then
pwd
ls -alh
cp .env.example .env
php artisan key:generate
fi
$@ &
fpm=$!
wait "$fpm"
\ No newline at end of file
#!/bin/sh
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
then
>&2 echo 'ERROR: Invalid installer checksum'
rm composer-setup.php
exit 1
fi
php composer-setup.php --install-dir=/usr/local/bin --filename=composer --version=2.6.5
RESULT=$?
rm composer-setup.php
exit $RESULT
\ No newline at end of file
......@@ -2,10 +2,15 @@ version: "3"
services:
nginx:
restart: unless-stopped
depends_on:
- fpm
build:
dockerfile: ./build/nginx/Dockerfile
target: development
image: metagermaps:nginx-latest
target: ${ENVIRONMENT}
args:
USER: ${USER}
GROUP: ${GROUP}
image: metagermaps:nginx-${IMAGE_TAG}
ports:
- 8080:80
working_dir: /html
......@@ -15,8 +20,24 @@ services:
restart: unless-stopped
build:
dockerfile: ./build/fpm/Dockerfile
target: development
image: metagermaps:fpmlatest
working_dir: /html
target: ${ENVIRONMENT}
image: metagermaps:fpm-${IMAGE_TAG}
volumes:
- ./app:/html
- vendor:/html/vendor
- bootstrap-cache:/html/bootstrap/cache
composer:
restart: on-failure
build:
dockerfile: ./build/fpm/Dockerfile
target: composer
image: metagermaps:composer-${IMAGE_TAG}
volumes:
- ./app:/html
- composer-cache:/mgmaps/.composer
- vendor:/html/vendor
- bootstrap-cache:/html/bootstrap/cache
volumes:
composer-cache: {}
vendor: {}
bootstrap-cache: {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment