Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
67 lines (53 loc) · 1.6 KB
/
Copy pathDockerfile
File metadata and controls
67 lines (53 loc) · 1.6 KB
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
62
63
64
65
66
67
# syntax=docker/dockerfile:1
# Build API docs with PHP 8.2
FROM alpine:3.19 AS builder
RUN apk add --no-cache \
bash \
curl \
git \
make \
openssh-client \
php82 \
php82-bz2 \
php82-curl \
php82-dom \
php82-iconv \
php82-intl \
php82-json \
php82-mbstring \
php82-openssl \
php82-phar \
php82-simplexml \
php82-tokenizer \
php82-xml \
php82-xmlwriter \
php82-zip
RUN ln -sf /usr/bin/php82 /usr/bin/php
WORKDIR /data
# Install generator dependencies independently of source, template and asset edits.
COPY composer.json composer.lock ./
RUN --mount=type=cache,target=/root/.composer/cache \
curl -sS https://getcomposer.org/installer | php \
&& php composer.phar install --no-interaction --prefer-dist
COPY . /data
# Change DOCS_CACHE_REFRESH to re-resolve dependencies even for unchanged source refs.
ARG DOCS_CACHE_REFRESH=
ENV DOCS_CACHE_DIR=/cache/docs
RUN --mount=type=cache,target=/sources,sharing=locked \
--mount=type=cache,target=/cache/docs,sharing=locked \
--mount=type=cache,target=/root/.composer/cache,sharing=locked \
DOCS_CACHE_REFRESH="$DOCS_CACHE_REFRESH" sh bin/build-all.sh
# nginx server
FROM alpine:3.19
LABEL Description="CakePHP API Docs"
RUN apk add --no-cache \
nginx \
openssh-client
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
COPY nginx.conf /etc/nginx/http.d/default.conf
WORKDIR /var/www/html
COPY --from=builder /data/build/api ./
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]