You need to bring your own computer to the practical.
Make sure you have Docker installed you can execute following command:
docker run hello-world
In addition, please run following command before attending the practical.
# Apache with PHP
docker pull php:8.3.6-apache
You need to have the nswi153/frontend Docker image from previous practical.
Services are defined in docker-compose.yaml file. Values for environment variables are automatically loaded from .env file.
version: '3.8'
services:
client:
image: nswi153/frontend
ports:
- 8090:80
environment:
SERVER_URL: 'https://webik.ms.mff.cuni.cz/nswi153/2024-2025/service/09/api/'
./practical-10/
Copy practical-03/backend and practical-09/frontend from previous practicals to practical-10.
Create a Dockerfile for a container hosting the web application backend. Name the image nswi153/backend. Update the source code of the application so that:
Use php:8.3.6-apache as a base image.
You are allowed to modify the copied files.
This is a list of steps that you need to carry out to create functional Docker image for the assignment.
sed -i 's/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf
a2enmod rewrite
apt-get update
apt-get -y --no-install-recommends install unzip libpq-dev
docker-php-ext-install pgsql
./practical-10/
Create docker-compose.yaml file hosting:
./practical-10/postgres
Create Dockerfile with postgres:16.2. Automatically populate the database nswi153 with articles and authors.
Once ready utilize the image in the docker-compose file as the database. You may need to modify other files in the practical-10 directory to make it work.
You must implement and push the assignments to GitLab before 8.5.2025 23:59 UTC.
Content beyond this slide is not mandatory part of the seminar. Yet it may help you with better use and understanding of Docker.
We can employ tools like Watchtower to automatically update the containers.