-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
61 lines (44 loc) · 2.15 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
49
50
51
52
53
54
55
56
57
58
59
60
61
##################################################################################################################
# Dependency Stage
##################################################################################################################
FROM composer:2 AS vendor
WORKDIR /app/
COPY composer.json composer.lock /app/
COPY . /app/
RUN composer install \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist \
--classmap-authoritative \
--no-ansi \
--no-dev
##################################################################################################################
# Base Stage
##################################################################################################################
FROM php:7.4-cli-alpine AS php-base
RUN apk add --update --no-cache gmp gmp-dev \
&& docker-php-ext-install -j$(nproc) gmp bcmath
COPY . /app/
COPY --from=vendor /app/vendor/ /app/vendor/
WORKDIR /app/
COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
RUN chmod +x /usr/local/bin/docker-entrypoint
##################################################################################################################
# Test Stage
##################################################################################################################
FROM php-base AS test
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
COPY --from=vendor /usr/bin/composer /usr/bin/composer
# run the test script(s) from composer, this validates the application before allowing the build to succeed
RUN composer install --no-interaction --no-plugins --no-scripts --prefer-dist --no-ansi --ignore-platform-reqs
RUN vendor/bin/phpunit --testdox
##################################################################################################################
# Production Stage
##################################################################################################################
FROM php-base AS production
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
# compile the container for performance reasons
RUN /app/bin/bolt11 >/dev/null
ENTRYPOINT ["docker-entrypoint"]