Repository navigation
Expand file tree
/
Copy pathDockerfile-dev
More file actions
56 lines (42 loc) · 2.23 KB
/
Copy pathDockerfile-dev
File metadata and controls
56 lines (42 loc) · 2.23 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
FROM alpine:3.22
LABEL Maintainer="Thilina, Pituwala <thilina@icehrm.com>" \
Description="IceHrm Docker Container with Nginx & PHP-FPM based on Alpine Linux."
RUN apk --no-cache add bind-tools
# Install packages. PHP is pinned to the 8.3 series explicitly (the unversioned `php`
# meta-package can resolve to a different series between Alpine releases) so dev
# tracks the same branch as the production image.
RUN apk --no-cache add php83 php83-fpm php83-opcache php83-mysqli php83-json php83-openssl php83-curl \
php83-zlib php83-xml php83-phar php83-intl php83-dom php83-simplexml php83-xmlreader php83-ctype php83-session \
php83-mbstring php83-gd php83-tokenizer php83-zip php83-iconv unzip nginx supervisor curl nodejs npm
# xdebug from the Alpine package (no compiler toolchain needed). The package ships
# /etc/php83/conf.d/50_xdebug.ini with the zend_extension line commented out, so it is
# installed but NOT loaded until a developer uncomments it and sets xdebug.mode.
RUN apk --no-cache add php83-pecl-xdebug
# Create symlink for php command
RUN ln -sf /usr/bin/php83 /usr/bin/php
# Configure nginx
COPY docker/development/config/nginx.conf /etc/nginx/nginx.conf
# Remove default server definition
#RUN rm /etc/nginx/conf.d/default.conf
# Configure PHP-FPM
COPY docker/development/config/fpm-pool.conf /etc/php83/php-fpm.d/www.conf
COPY docker/development/config/php.ini /etc/php83/conf.d/custom.ini
# Configure supervisord
COPY docker/development/config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
# Setup document root
RUN mkdir -p /var/www/html
# Make sure files/folders needed by the processes are accessable when they run under the nobody user
RUN chown -R nobody:nobody /var/www/html && \
chown -R nobody:nobody /run && \
chown -R nobody:nobody /var/lib/nginx && \
chown -R nobody:nobody /var/log/nginx
# Switch to use a non-root user from here on
USER nobody
# Add application
WORKDIR /var/www/html
# Expose the port nginx is reachable on
EXPOSE 8080
# Let supervisord start nginx & php-fpm
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
# Configure a healthcheck to validate that everything is up&running
HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping