Skip to content

Commit

Permalink
Merge pull request #184 from LibreCodeCoop/feature/dockerfile
Browse files Browse the repository at this point in the history
change dockerfile
  • Loading branch information
vitormattos authored May 17, 2024
2 parents afcbcf0 + 60b3de5 commit 9bda24a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 41 deletions.
43 changes: 43 additions & 0 deletions .docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM php:8.3-fpm

ARG NODE_MAJOR=20

RUN apt-get update \
&& apt-get install -y \
git \
espeak-ng \
# Install node
ca-certificates \
curl \
gnupg \
# see https://github.com/nodesource/distributions
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
&& apt-get update \
&& apt-get install nodejs -y \
&& node --version \
&& npm --version \
# Clean package cache
&& rm -rf /var/lib/apt/lists/*

# Install PHP extensions and Composer
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync \
&& install-php-extensions \
gd \
xdebug \
zip \
@composer \
&& rm /usr/local/bin/install-php-extensions

COPY xdebug.ini /usr/local/etc/php/conf.d/

RUN echo "alias jigsaw=./vendor/bin/jigsaw" >> /etc/bash.bashrc && \
echo "alias compile='./vendor/bin/jigsaw build'" >> /etc/bash.bashrc && \
/bin/bash -c "source /etc/bash.bashrc"

WORKDIR /var/www/html

COPY entrypoint.sh /var/www/scripts/
ENTRYPOINT [ "bash", "/var/www/scripts/entrypoint.sh" ]
21 changes: 10 additions & 11 deletions .docker/php/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
#!/bin/bash

# Set uid of host machine
usermod --non-unique --uid "${HOST_UID}" www-data
groupmod --non-unique --gid "${HOST_GID}" www-data

# Composer
if [ ! -d "vendor" ]; then
composer i
composer global require hirak/prestissimo
fi
composer install

# NPM
. $NVM_DIR/nvm.sh
if [ ! -d "node_modules" ]; then
npm install
fi
php-fpm &
if [[ "$SERVER_MODE" == 'watch' ]]; then
npm run watch
else
php ./vendor/bin/jigsaw serve --host 0.0.0.0 --port 3000
fi
npm run watch
27 changes: 0 additions & 27 deletions .docker/php7/Dockerfile

This file was deleted.

5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '3.3'
services:
php7:
build: .docker/php7
php:
build: .docker/php
ports:
- 80:3000
volumes:
Expand Down

0 comments on commit 9bda24a

Please sign in to comment.