File tree Expand file tree Collapse file tree 3 files changed +27
-7
lines changed
chapters/web-application-security/web-basics/drills/surprise/deploy Expand file tree Collapse file tree 3 files changed +27
-7
lines changed Original file line number Diff line number Diff line change 1+ # Stage 1: Generate the source file with the flag
2+ FROM alpine:latest AS builder
3+
4+ ARG FLAG
5+ COPY src/main.template.py /tmp/main.template.py
6+ RUN sed "s/__TEMPLATE__/${FLAG}/g" /tmp/main.template.py > /tmp/main.py
7+
8+ # Stage 2: Final image
19FROM tiangolo/uwsgi-nginx-flask:python3.8
210
311# copy over our requirements.txt file
@@ -6,5 +14,5 @@ COPY src/requirements.txt /tmp/
614# upgrade pip and install required python packages
715RUN pip3 install --no-cache-dir -r /tmp/requirements.txt && mkdir app
816
9- # copy over our app code
10- COPY src /main.py /app
17+ # copy the generated source file from builder stage
18+ COPY --from=builder /tmp /main.py /app
Original file line number Diff line number Diff line change 11EXTERNAL_PORT := 8093
2- IMG_NAME := sss-web-01_surprise
3- FILE_TEMPLATE := ../src/main.template.py
4- FILE_SRC := ../src/main.py
2+ INTERNAL_PORT := 80
3+ NAME := web-basics_surprise
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
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments