-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
59 lines (46 loc) · 1.91 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
FROM php:7.4-cli-alpine
# environment variables
ARG EVOSC_GIT="https://github.com/EvoTM/EvoSC.git"
ARG EVOSC_BRANCH="develop"
ARG BUILD_DATE
ARG REVISION
ARG EVOSC_VERSION
# labels
LABEL org.opencontainers.image.title="EvoSC Trackmania/ManiaPlanet Server Controller" \
org.opencontainers.image.description="Server Controller for Trackmania and ManiaPlanet servers." \
org.opencontainers.image.version=${EVOSC_VERSION} \
org.opencontainers.image.created=${BUILD_DATE} \
org.opencontainers.image.authors="Nicolas Graf <[email protected]>" \
org.opencontainers.image.vendor="Evo" \
org.opencontainers.image.licenses="Apache-2.0" \
org.opencontainers.image.revision=${REVISION}
# create base dir
RUN set -eux; \
addgroup -g 9999 evosc && \
adduser -u 9999 -Hh /controller -G evosc -s /sbin/nologin -D evosc && \
install -d -o evosc -g evosc -m 775 /controller
WORKDIR /controller
# install packages
RUN apk add --no-cache unzip git libpng-dev zlib-dev curl-dev libzip-dev zip jq su-exec procps libjpeg-turbo-dev bash
# install composer
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
# install php extensions
RUN docker-php-ext-configure gd --with-jpeg && docker-php-ext-install gd && \
docker-php-ext-install curl mysqli pdo_mysql zip pcntl
# increase default memory limit
RUN echo 'memory_limit = 512M' >> /usr/local/etc/php/conf.d/docker-php-memlimit.ini
# install evosc
RUN git clone --branch ${EVOSC_BRANCH} ${EVOSC_GIT} /controller && \
composer i --no-dev && \
chown evosc:evosc -Rf /controller
# copy entrypoint.sh
COPY entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh
# check if the process is still up
HEALTHCHECK --interval=5s --timeout=5s --start-period=20s --retries=3 \
CMD pgrep -x php || exit 1
# switch to non-root user
USER evosc
# set entrypoint
ENTRYPOINT [ "entrypoint.sh" ]
CMD [ "php", "esc", "run" ]