Skip to content

Commit 906054e

Browse files
committed
chore(web-basics): update produce-consume challenge
Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com>
1 parent 9f48b74 commit 906054e

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed
Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# Stage 1: Generate the source file with the flag
2+
FROM alpine:latest AS builder
3+
4+
ARG FLAG
5+
COPY src/consume.template.php /tmp/consume.template.php
6+
RUN sed "s/__TEMPLATE__/${FLAG}/g" /tmp/consume.template.php > /tmp/consume.php
7+
8+
# Stage 2: Final image
19
FROM php:7.2-apache
210

3-
COPY /src /var/www/html/produce-consume/
11+
COPY src/index.php /var/www/html/produce-consume/
12+
COPY src/produce.php /var/www/html/produce-consume/
13+
COPY --from=builder /tmp/consume.php /var/www/html/produce-consume/
Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
EXTERNAL_PORT := 8091
2-
IMG_NAME := sss-web-01_produce-consume
3-
FILE_TEMPLATE := ../src/consume.template.php
4-
FILE_SRC := ../src/consume.php
2+
INTERNAL_PORT := 80
3+
NAME := web-basics_produce-consume
4+
FLAG := $(shell cat ../flag)
55

6-
include activity.mk
6+
run: build
7+
docker run -d -p $(EXTERNAL_PORT):$(INTERNAL_PORT) --name $(NAME) -t $(NAME)
8+
9+
build:
10+
docker build --build-arg FLAG=$(FLAG) -t $(NAME) -f Dockerfile ..
11+
12+
stop:
13+
docker stop $(NAME)
14+
15+
clean: stop
16+
docker rm $(NAME)
17+
docker image rm $(NAME):latest
18+
19+
.PHONY: run build stop clean

chapters/web-application-security/web-basics/drills/produce-consume/deploy/activity.mk

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)