-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile-alpine.template
64 lines (49 loc) · 3.89 KB
/
Dockerfile-alpine.template
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
FROM alpine:%%ALPINE_VERSION%%
LABEL maintainer="Marcin Haba <marcin.haba@bacula.pl>"
ENV BACULARIS_VERSION=%%BACULARIS_VERSION%%
ENV PACKAGE_NAME=%%PACKAGE_NAME%%
ENV PHP_VERSION=82
ENV WEB_USER=nginx
RUN if [ "${PACKAGE_NAME}" = 'standalone' ] || [ "${PACKAGE_NAME}" = 'api-dir' ]; then \
apk add postgresql16; \
mkdir -m 0777 /run/postgresql; \
chown postgres:postgres /run/postgresql; \
fi && \
if [ "${PACKAGE_NAME}" = 'standalone' ] || [ "${PACKAGE_NAME}" = 'web' ]; then \
apk add expect openssh-client gnupg; \
fi && \
mkdir -m 0770 /run/bacula && \
apk add nginx && \
apk add bacula bacula-pgsql bacula-client && \
chown root:bacula /etc/bacula /etc/bacula/bacula-fd.conf /var/lib/bacula/archive && \
chmod 775 /etc/bacula /var/lib/bacula/archive && \
chown bacula:bacula /run/bacula && \
addgroup ${WEB_USER} bacula && \
apk add bash sudo && \
apk add php${PHP_VERSION}-bcmath php${PHP_VERSION}-curl php${PHP_VERSION}-dom php${PHP_VERSION}-json php${PHP_VERSION}-ldap php${PHP_VERSION}-pdo php${PHP_VERSION}-pgsql php${PHP_VERSION}-pdo_pgsql php${PHP_VERSION}-mysqlnd php${PHP_VERSION}-pdo_mysql php${PHP_VERSION}-intl php${PHP_VERSION}-ctype php${PHP_VERSION}-session php${PHP_VERSION}-fpm php${PHP_VERSION}-openssl && \
sed -i "/listen = / s!127.0.0.1:9000!/var/run/php-fpm.sock!; /user = / s!nobody!${WEB_USER}!; /group = / s!nobody!${WEB_USER}!; s!;listen.group!listen.group!" /etc/php${PHP_VERSION}/php-fpm.d/www.conf && \
if [ "${PACKAGE_NAME}" = 'standalone' ] || [ "${PACKAGE_NAME}" = 'api-dir' ]; then \
# Fix job to backup catalog database
sed -i 's!make_catalog_backup MyCatalog!make_catalog_backup bacula!' /etc/bacula/bacula-dir.conf; \
fi
EXPOSE 9101/tcp 9102/tcp 9103/tcp 9097/tcp
COPY "docker/systems/alpine/sudoers.d/bacularis-${PACKAGE_NAME}" /etc/sudoers.d/
COPY "docker/systems/alpine/entrypoint/docker-entrypoint.inc" /
COPY "docker/systems/alpine/entrypoint/docker-entrypoint-${PACKAGE_NAME}.sh" /docker-entrypoint.sh
COPY bacularis /var/www/bacularis
COPY "docker/systems/alpine/config/API/api-${PACKAGE_NAME}.conf" /var/www/bacularis/protected/vendor/bacularis/bacularis-api/API/Config/api.conf
COPY --chown=${WEB_USER}:${WEB_USER} common/config/API/* /var/www/bacularis/protected/vendor/bacularis/bacularis-api/API/Config/
COPY --chown=${WEB_USER}:${WEB_USER} common/config/Web/* /var/www/bacularis/protected/vendor/bacularis/bacularis-web/Web/Config/
RUN if [ "${PACKAGE_NAME}" = 'web' ]; then \
rm /var/www/bacularis/protected/vendor/bacularis/bacularis-api/API/Config/*.conf; \
rm /var/www/bacularis/protected/vendor/bacularis/bacularis-web/Web/Config/*.conf; \
sed -i '/service id="oauth"/d; /service id="api"/d; /service id="panel"/d; s!BasePath="Bacularis.Common.Pages"!BasePath="Bacularis.Web.Pages"!; s!DefaultPage="CommonPage"!DefaultPage="Dashboard"!;' /var/www/bacularis/protected/application.xml; \
fi && \
if [ "${PACKAGE_NAME}" = 'api-dir' ] || [ "${PACKAGE_NAME}" = 'api-sd' ] || [ "${PACKAGE_NAME}" = 'api-fd' ]; then \
rm /var/www/bacularis/protected/vendor/bacularis/bacularis-web/Web/Config/*.conf; \
sed -i 's!BasePath="Bacularis.Common.Pages"!BasePath="Bacularis.API.Pages.Panel"!; s!DefaultPage="CommonPage"!DefaultPage="APIHome"!; /service id="web"/d;' /var/www/bacularis/protected/application.xml; \
fi && \
/var/www/bacularis/protected/tools/install.sh -w nginx -c /etc/nginx/http.d -u ${WEB_USER} -d /var/www/bacularis/htdocs -p /var/run/php-fpm.sock
VOLUME ["/var/lib/postgresql/data", "/etc/bacula", "/var/lib/bacula", "/var/www/bacularis/protected/vendor/bacularis/bacularis-api/API/Config", "/var/www/bacularis/protected/vendor/bacularis/bacularis-api/API/Logs", "/var/www/bacularis/protected/vendor/bacularis/bacularis-web/Web/Config", "/var/www/bacularis/protected/vendor/bacularis/bacularis-web/Web/Logs", "/var/www/bacularis/protected/vendor/bacularis/bacularis-common/Common/Working"]
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD ["nginx", "-g", "daemon off;"]