Commit 8696c99b authored by Hannah Kalker's avatar Hannah Kalker
Browse files

Projekt angelegt

parents
Pipeline #40651 failed with stages
in 2 minutes and 21 seconds
FROM php:8.0-fpm-alpine
WORKDIR /var/www
RUN apk update && apk add \
build-base \
vim
RUN docker-php-ext-install pdo_mysql
RUN addgroup -g 1000 -S www && \
adduser -u 1000 -S www -G www
USER www
COPY --chown=www:www ../../Downloads/php-cli-coding-challenge /var/www
EXPOSE 9000
# CHECK24 PHP CLI CodingChallenge
## Prepare Your Environment
We have prepared a development environment for you <3 You can use the command below to start your dev container.
> docker-compose up --build
In a second terminal window you can check your running container:
> docker ps
This should output a list of your running containers similar to this list:
```
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8db9a1a9276f php-cli-coding-challenge "docker-php-entrypoi…" 8 seconds ago Restarting (0) 1 second ago php-cli-coding-challenge
```
Next you can run the prepared "hello world" example:
> docker exec -ti php-cli-coding-challenge /usr/local/bin/php /app/index.php
As you can see this outputs `"Good Luck!"` to you. This is the interpreted output from php of the file `app/index.php`. Here
you will implement your code.
However, You certainly don't want to run this command over and over, so we'll use watch to keep it running for you
> watch 'docker exec -ti php-cli-coding-challenge /usr/local/bin/php /app/index.php'
The output will be updated as soon as you save your working file
## Get Started with the coding challenge
- Fetch the HTML-Response from a given site (e.g. spiegel.de)
- count the ocurrences of a given word
- count the ocurrences of all words - output them in an descending order with the counted amount (143 x Beispielwort, 109 Spielbeiwort, ...)
<?php
class FileDownloader
{
}
\ No newline at end of file
<?php
class WordCounter
{
//Extractor und Downloader im Konstruktor
}
\ No newline at end of file
<?php
class WordExtractor
{
}
\ No newline at end of file
<?php
declare(strict_types = 1);
include_once 'WordExtractor.php'; //werden später durch Autoloader ersetzt
include_once 'WordCounter.php';
include_once 'FileDownloader.php';
echo "Good Luck!";
version: "3"
services:
app:
build:
context: ../../Downloads/php-cli-coding-challenge
dockerfile: Dockerfile
image: php-cli-coding-challenge
container_name: php-cli-coding-challenge
restart: unless-stopped
volumes:
- ./app:/app
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment