Skip to content

Commit

Permalink
feat: add a new dockerfile for a complete dev image
Browse files Browse the repository at this point in the history
  • Loading branch information
e-picas committed Feb 4, 2024
1 parent 1ce005c commit 7874683
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .releaserc.yml
Expand Up @@ -37,7 +37,7 @@ plugins:
${nextRelease.notes}
- path: "@semantic-release/exec"
verifyReleaseCmd: "echo \"${nextRelease.version}\" > /tmp/mde-next_release"
publishCmd: "php bin/mde-dev --release=${nextRelease.version} make-release"
prepareCmd: "php bin/mde-dev --release=${nextRelease.version} make-release"
- path: "@semantic-release/github"
- path: "@saithodev/semantic-release-backmerge"
backmergeBranches:
Expand Down
18 changes: 18 additions & 0 deletions Makefile
Expand Up @@ -176,6 +176,24 @@ gitflow-publish-release:
git push --delete origin ${CURRENT_BRANCH_NAME}
.PHONY: gitflow-publish-release

# This one is for hard dev and not documented ...
docker-dev-build:
docker build \
-f $$(pwd)/docker/dev-full/Dockerfile \
-t mde_dev_full \
--build-arg IMAGE_VERSION=${DOCKER_IMAGE_PHP} \
$$(pwd)/
.PHONY: docker-dev-build
docker-dev-run: docker-dev-build
docker run -ti --rm \
-v $${HOME}/.ssh:/home/app_user/.ssh \
-v $$(pwd):/mde-src \
-w /mde-src/ \
--name mde_dev_full_run \
mde_dev_full \
bash
.PHONY: docker-dev-run

# largely inspired by <https://docs.cloudposse.com/reference/best-practices/make-best-practices/>
help:
@printf "#############################################\n!! THIS FILE IS FOR DEVELOPMENT USAGE ONLY !!\n#############################################\n"
Expand Down
65 changes: 65 additions & 0 deletions docker/dev-full/Dockerfile
@@ -0,0 +1,65 @@
# arguments to adapt the build
ARG IMAGE_VERSION=7

# base image with PHP & Apache
FROM php:${IMAGE_VERSION} AS mde_dev

# install dependencies
RUN set -ex; \
export DEBIAN_FRONTEND=noninteractive; \
apt update; \
apt install -y --no-install-recommends \
git \
graphviz \
libxslt1-dev \
libxml2-dev \
libyaml-dev \
libzip-dev \
man \
openssh-client \
wget \
;

RUN set -ex; \
docker-php-ext-install -j "$(nproc)" \
bcmath \
xsl \
zip \
;
RUN set -ex; pecl install yaml && docker-php-ext-enable yaml;
RUN set -ex; pecl install xdebug-3.1.4 && docker-php-ext-enable xdebug; \
echo 'xdebug.mode=coverage' > /usr/local/etc/php/conf.d/xdebug.ini;
RUN echo "phar.readonly = Off" > /usr/local/etc/php/php.ini;

# install nvm
ENV NODE_VERSION v21.6.1
ENV NVM_DIR /usr/local/nvm
RUN mkdir $NVM_DIR \
&& curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
RUN echo "source $NVM_DIR/nvm.sh && \
nvm install $NODE_VERSION && \
nvm alias default $NODE_VERSION && \
nvm use default" | bash
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

RUN echo "source /root/.bashrc \
&& npm install -g \
semantic-release \
@semantic-release/github \
@semantic-release/git \
@semantic-release/changelog \
@semantic-release/exec \
@saithodev/semantic-release-backmerge" | bash

# install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& chmod +x /usr/local/bin/composer

# install phpdoc
RUN wget -O /usr/local/bin/phpdoc https://github.com/phpDocumentor/phpDocumentor/releases/download/v2.9.1/phpDocumentor.phar \
&& chmod +x /usr/local/bin/phpdoc

RUN addgroup --gid 1000 app_user && adduser --system --uid 1000 --gid 1000 app_user
RUN cp /root/.bashrc /home/app_user/ && chown 1000:1000 /home/app_user/.bashrc
USER app_user

0 comments on commit 7874683

Please sign in to comment.