Skip to content

Commit 230b523

Browse files
committed
chore(cookies): update great-names challenge
Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com>
1 parent 1d6985d commit 230b523

File tree

4 files changed

+21
-45
lines changed

4 files changed

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

3-
COPY /public /var/www/html/
11+
COPY --from=builder /tmp/index.php /var/www/html/
Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
FILE :=../flag
2-
FLAG :=$(shell cat $(FILE))
3-
4-
build:
5-
docker build -f Dockerfile -t sss-web-02_great-names ..
1+
EXTERNAL_PORT := 8080
2+
INTERNAL_PORT := 80
3+
NAME := cookies-and-session-management_great-names
4+
FLAG := $(shell cat ../flag)
65

76
run: build
8-
docker run -d -p 8080:80 --name sss-web-02_great-names sss-web-02_great-names
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 ..
911

1012
stop:
11-
docker stop sss-web-02_great-names
13+
docker stop $(NAME)
1214

1315
clean: stop
14-
docker rm sss-web-02_great-names
16+
docker rm $(NAME)
17+
docker image rm $(NAME):latest
1518

16-
.PHONY: build run stop clean
19+
.PHONY: run build stop clean

chapters/web-application-security/cookies-and-session-management/drills/great-names/public/index.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

chapters/web-application-security/cookies-and-session-management/drills/great-names/src/Makefile

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)