Skip to content

Commit

Permalink
fix(docker): add Docker resources
Browse files Browse the repository at this point in the history
Add missing resources to build and run Docker image.

Resolve: #183
  • Loading branch information
dfranco committed Jan 14, 2024
1 parent 9818d99 commit fb11ade
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
**/.github
**/.git
**/.gitignore
**/.phpcs.xml
**/.readthedocs.yaml
**/.travis.yml
**/.tx
**/phpunit.xml
**/release-please-config.json
**/.release-please-manifest.json
**/sonar-project.properties
**/tests
48 changes: 48 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM php:8.1-apache

ARG ENV=production

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y unzip libpq-dev libzip-dev curl sqlite3 && \
docker-php-ext-install pgsql pdo_pgsql pdo_mysql gettext zip

COPY ./src/ /var/www/html/

# Install Composer binary
COPY --from=composer /usr/bin/composer /usr/bin/composer

WORKDIR /var/www/html

RUN composer install --prefer-dist --no-dev

RUN mv "$PHP_INI_DIR/php.ini-${ENV}" "$PHP_INI_DIR/php.ini"

COPY config/apache-vhost.config /etc/apache2/sites-enabled/000-default.conf

# locales
RUN apt-get install -y gettext locales && \
echo 'be_BY.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'ca_ES.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'de_DE.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'es_ES.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'fr_FR.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'it_IT.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'ja_JP.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'nl_NL.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'nn_NO.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'pl_PL.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'pt_BR.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'ro_RO.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'ru_RU.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'sv_SE.UTF-8 UTF-8' >> /etc/locale.gen && \
echo 'zh_CN.UTF-8 UTF-8' >> /etc/locale.gen && locale-gen

RUN apt-get remove -y libpq-dev libzip-dev

ARG user_id=1000

RUN usermod -u $user_id www-data
RUN chown -v www-data /var/www/html/application/views/cache
RUN a2enmod rewrite
41 changes: 41 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
® Using Docker

## Building the Docker image

This section describe how to build Bacula-Web Docker image

Set version

```shell
# e.g: export ver=9.4.0
export ver=x.y.z
```

Clone from git repo
```shell
rm -rf src
git clone -b v$ver https://github.com/bacula-web/bacula-web.git src
```

Build using docker buildx

```shell
docker buildx build --load \
--no-cache \
--platform linux/amd64 \
--tag baculaweb/bacula-web:latest \
-f Dockerfile .
```

Clean-up temp source folder
```shell
rm -rf src
```

## Using the Docker image

See [Bacula-Web Docker image on DockerHub](https://hub.docker.com/r/baculaweb/bacula-web)

## Bug report and feature request

See [bug report and feature request](https://docs.bacula-web.org/en/latest/03_get-help/support.html) in documentation
15 changes: 15 additions & 0 deletions docker/config/apache-vhost.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<VirtualHost *:80>

ServerName bacula-web.home

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/public

<Directory /var/www/html/public>
AllowOverride All
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
10 changes: 10 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
web:
image: baculaweb/bacula-web:latest
container_name: "bacula-web"
restart: unless-stopped
ports:
- "8080:80"
volumes:
- ${PWD}/config.php:/var/www/html/application/config/config.php
- ${PWD}/protected:/var/www/html/application/assets/protected

0 comments on commit fb11ade

Please sign in to comment.