-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile-debian.template
74 lines (59 loc) · 4.22 KB
/
Dockerfile-debian.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
65
66
67
68
69
70
71
72
73
74
FROM debian:%%DEBIAN_VERSION%%
LABEL maintainer="Marcin Haba <marcin.haba@bacula.pl>"
ENV BACULARIS_VERSION=%%BACULARIS_VERSION%%
ENV PACKAGE_NAME=%%PACKAGE_NAME%%
ENV PHP_VERSION=8.4
ENV WEB_USER=www-data
RUN apt update && \
apt -y install bacula-common && \
if [ "${PACKAGE_NAME}" = 'standalone' ] || [ "${PACKAGE_NAME}" = 'api-dir' ]; then \
apt -y install postgresql; \
/etc/init.d/postgresql start; \
sed -i 's!peer$!trust!g' /etc/postgresql/16/main/pg_hba.conf; \
mkdir /etc/dbconfig-common; \
echo "dbc_install=false\ndbc_dbtype=pgsql\ndbc_name=bacula\ndbc_address=localhost\ndbc_dbuser=bacula\ndbc_dbpassword=" > /etc/dbconfig-common/bacula-director-pgsql.conf; \
apt -y install dbconfig-no-thanks bacula-director bacula-director-pgsql bacula-console; \
sed -i 's!XXX_DBNAME_XXX!bacula!g; s!XXX_DBUSER_XXX!bacula!g; s!XXX_DBPASSWORD_XXX!bacula!g; /DirAddress = 127.0.0.1/d' /etc/bacula/bacula-dir.conf; \
fi && \
if [ "${PACKAGE_NAME}" = 'standalone' ] || [ "${PACKAGE_NAME}" = 'api-sd' ]; then \
apt -y install bacula-sd; \
mkdir 770 /var/lib/bacula/archive; \
chown bacula:tape /var/lib/bacula/archive; \
sed -i 's!/nonexistant/path/to/file/archive/dir!/var/lib/bacula/archive!g; /SDAddress = 127.0.0.1/d' /etc/bacula/bacula-sd.conf; \
fi && \
if [ "${PACKAGE_NAME}" = 'standalone' ] || [ "${PACKAGE_NAME}" = 'api-fd' ]; then \
apt -y install bacula-fd; \
sed -i '/FDAddress = 127.0.0.1/d' /etc/bacula/bacula-fd.conf; \
fi && \
if [ "${PACKAGE_NAME}" = 'standalone' ] || [ "${PACKAGE_NAME}" = 'web' ]; then \
apt -y install expect gnupg openssh-client; \
fi && \
chown root:bacula /etc/bacula && \
chmod 775 /etc/bacula && \
chmod 660 /etc/bacula/*.conf || true && \
apt -y install nginx && \
usermod -a -G bacula ${WEB_USER} && \
apt -y install sudo php-bcmath php-curl php-dom php-json php-ldap php-pgsql php-pgsql php-mysql php-intl php-fpm && \
apt -y -f install
EXPOSE 9101/tcp 9102/tcp 9103/tcp 9097/tcp
COPY "docker/systems/debian/sudoers.d/bacularis-${PACKAGE_NAME}" /etc/sudoers.d/
COPY "docker/systems/debian/entrypoint/docker-entrypoint.inc" /
COPY "docker/systems/debian/entrypoint/docker-entrypoint-${PACKAGE_NAME}.sh" /docker-entrypoint.sh
COPY bacularis /var/www/bacularis
COPY "docker/systems/debian/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/sites-available -u ${WEB_USER} -d /var/www/bacularis/htdocs -p /var/run/php/php${PHP_VERSION}-fpm.sock && \
ln -s /etc/nginx/sites-available/bacularis-nginx.conf /etc/nginx/sites-enabled/
VOLUME ["/var/lib/postgresql", "/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;"]