From f1d2a937526ee712def466a0fc615a1c69519dae Mon Sep 17 00:00:00 2001 From: Lukian Date: Tue, 21 Jan 2025 08:39:08 +0100 Subject: [PATCH] Refactor Docker setup and replace web files with new structure --- compose.yml | 20 +++++++++++++------- docker/apache2/dockerfile | 9 ++++----- {public => docker/apache2/public}/index.html | 0 {public => docker/apache2/public}/style.css | 0 docker/attacker/dockerfile | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) rename {public => docker/apache2/public}/index.html (100%) rename {public => docker/apache2/public}/style.css (100%) diff --git a/compose.yml b/compose.yml index a3fd0bf..d7499f6 100644 --- a/compose.yml +++ b/compose.yml @@ -1,16 +1,22 @@ services: webserver: - dockerfile: docker/apache2/dockerfile - build: . + build: docker/apache2 ports: - - "5000:5000" + - 5000:5000 + - 80:80 volumes: - .:/code + networks: + - mynetwork attacker: - dockerfile: docker/attacker/dockerfile - build: . + build: docker/attacker ports: - - "5001:5001" + - 5001:5001 volumes: - .:/code - \ No newline at end of file + networks: + - mynetwork + +networks: + mynetwork: + external: false \ No newline at end of file diff --git a/docker/apache2/dockerfile b/docker/apache2/dockerfile index 268db58..3ada286 100644 --- a/docker/apache2/dockerfile +++ b/docker/apache2/dockerfile @@ -1,8 +1,7 @@ -FROM ubuntu:lastest AS webserver -RUN apt-get update && apt-get install -y apache2 - +FROM debian:stable-slim +RUN apt-get update \ + && apt-get install -y apache2 \ + && rm -rf /var/lib/apt/lists/* WORKDIR /var/www/html COPY ./public/ . - - CMD ["apache2ctl", "-D", "FOREGROUND"] \ No newline at end of file diff --git a/public/index.html b/docker/apache2/public/index.html similarity index 100% rename from public/index.html rename to docker/apache2/public/index.html diff --git a/public/style.css b/docker/apache2/public/style.css similarity index 100% rename from public/style.css rename to docker/apache2/public/style.css diff --git a/docker/attacker/dockerfile b/docker/attacker/dockerfile index 0e4c195..f0a2fe0 100644 --- a/docker/attacker/dockerfile +++ b/docker/attacker/dockerfile @@ -1,4 +1,4 @@ -FROM alpine:latest AS attacker +FROM alpine:latest RUN apk add --no-cache curl CMD ["curl", "webserver:80"] \ No newline at end of file