-
Notifications
You must be signed in to change notification settings - Fork 167
/
Dockerfile
48 lines (39 loc) · 1.39 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
FROM php:8.0-fpm
ARG BUILD_DATE
ARG VCS_REF
LABEL maintainer="Eduardo Bizarro <edbizarro@gmail.com>" \
PHP="8.0" \
NODE="14" \
org.label-schema.name="edbizarro/gitlab-ci-pipeline-php" \
org.label-schema.description=":coffee: Docker images for build and test PHP applications with Gitlab CI (or any other CI plataform!)" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.schema-version="1.0" \
org.label-schema.vcs-url="https://github.com/edbizarro/gitlab-ci-pipeline-php" \
org.label-schema.vcs-ref=$VCS_REF
# Set correct environment variables
ENV IMAGE_USER=php
ENV HOME=/home/$IMAGE_USER
ENV COMPOSER_HOME=$HOME/.composer
ENV PATH=$HOME/.yarn/bin:$PATH
ENV GOSS_VERSION="0.3.16"
ENV PHP_VERSION=8.0
USER root
WORKDIR /tmp
# COPY INSTALL SCRIPTS
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
COPY ./php/scripts/*.sh /tmp/
RUN chmod +x /tmp/*.sh
# Install
RUN bash ./packages.sh \
&& bash ./extensions.sh \
&& bash ./node.sh \
&& adduser --disabled-password --gecos "" $IMAGE_USER && \
echo "$IMAGE_USER ALL = ( ALL ) NOPASSWD: ALL" >> /etc/sudoers && \
mkdir -p /var/www/html && \
chown -R $IMAGE_USER:$IMAGE_USER /var/www $HOME \
&& rm -rf ~/.composer/cache/* \
&& chown -R $IMAGE_USER:$IMAGE_USER $COMPOSER_HOME \
&& curl -fsSL https://goss.rocks/install | GOSS_VER=v${GOSS_VERSION} sh \
&& bash ./cleanup.sh
USER $IMAGE_USER
WORKDIR /var/www/html