From cc6da85490944f8d61db3a84d6dc5ab52360a1d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vili=20Sinerv=C3=A4?= Date: Mon, 13 Mar 2023 21:37:15 +0200 Subject: [PATCH] Rest of part 1 exercises --- part1/exercise_1.10.txt | 8 ++++++++ part1/exercise_1.11.txt | 8 ++++++++ part1/exercise_1.12.txt | 8 ++++++++ part1/exercise_1.13.txt | 6 ++++++ part1/exercise_1.14.txt | 24 ++++++++++++++++++++++++ part1/exercise_1.6.txt | 4 ++++ part1/exercise_1.7.txt | 7 +++++++ part1/exercise_1.8.txt | 13 +++++++++++++ part1/exercise_1.9.txt | 3 +++ 9 files changed, 81 insertions(+) create mode 100644 part1/exercise_1.10.txt create mode 100644 part1/exercise_1.11.txt create mode 100644 part1/exercise_1.12.txt create mode 100644 part1/exercise_1.13.txt create mode 100644 part1/exercise_1.14.txt create mode 100644 part1/exercise_1.6.txt create mode 100644 part1/exercise_1.7.txt create mode 100644 part1/exercise_1.8.txt create mode 100644 part1/exercise_1.9.txt diff --git a/part1/exercise_1.10.txt b/part1/exercise_1.10.txt new file mode 100644 index 0000000..5c9ffac --- /dev/null +++ b/part1/exercise_1.10.txt @@ -0,0 +1,8 @@ +Command used: + +[devops@devops part1]$ docker run --rm -p 8080:8080 web-server + + +I then connected to http://devops:8080/ with Firefox from another machine and received: + +{"message":"You connected to the following path: /","path":"/"} diff --git a/part1/exercise_1.11.txt b/part1/exercise_1.11.txt new file mode 100644 index 0000000..85ba9c2 --- /dev/null +++ b/part1/exercise_1.11.txt @@ -0,0 +1,8 @@ +FROM openjdk:8-oracle + +EXPOSE 8080 +WORKDIR /usr/src/app +COPY pom.xml ./ +COPY . . +RUN ./mvnw package +CMD ["java", "-jar", "./target/docker-example-1.1.3.jar"] diff --git a/part1/exercise_1.12.txt b/part1/exercise_1.12.txt new file mode 100644 index 0000000..f970096 --- /dev/null +++ b/part1/exercise_1.12.txt @@ -0,0 +1,8 @@ +FROM node:16.19 +EXPOSE 5000 +WORKDIR /usr/src/app +COPY package*.json ./ +COPY . . +RUN npm install && npm run build +RUN npm install -g serve +CMD ["serve", "-s", "-l", "5000", "build"] diff --git a/part1/exercise_1.13.txt b/part1/exercise_1.13.txt new file mode 100644 index 0000000..05bf799 --- /dev/null +++ b/part1/exercise_1.13.txt @@ -0,0 +1,6 @@ +FROM golang:1.16 +EXPOSE 8080 +WORKDIR /usr/src/app +COPY . . +RUN go build +CMD ["./server"] diff --git a/part1/exercise_1.14.txt b/part1/exercise_1.14.txt new file mode 100644 index 0000000..c1c4d58 --- /dev/null +++ b/part1/exercise_1.14.txt @@ -0,0 +1,24 @@ +Commands used: +docker run --rm -it -p 5000:5000 example-frontend:1.14 +docker run --rm -it -p 8080:8080 example-backend:1.14 + +Dockerfile for frontend: +FROM node:16.19 +EXPOSE 5000 +WORKDIR /usr/src/app +COPY package*.json ./ +COPY . . +ENV REACT_APP_BACKEND_URL=http://devops:8080 +RUN npm install && npm run build +RUN npm install -g serve +CMD ["serve", "-s", "-l", "5000", "build"] + + +Dockerfile for backend: +FROM golang:1.16 +EXPOSE 8080 +WORKDIR /usr/src/app +COPY . . +ENV REQUEST_ORIGIN=http://devops:5000 +RUN go build +CMD ["./server"] diff --git a/part1/exercise_1.6.txt b/part1/exercise_1.6.txt new file mode 100644 index 0000000..364e472 --- /dev/null +++ b/part1/exercise_1.6.txt @@ -0,0 +1,4 @@ +[devops@devops part1]$ docker run -it devopsdockeruh/pull_exercise +Give me the password: basics +You found the correct password. Secret message is: +"This is the secret message" diff --git a/part1/exercise_1.7.txt b/part1/exercise_1.7.txt new file mode 100644 index 0000000..043c61a --- /dev/null +++ b/part1/exercise_1.7.txt @@ -0,0 +1,7 @@ +Dockerfile contents: + +FROM ubuntu:20.04 +WORKDIR /usr/src/app +RUN apt update && apt install -y curl +COPY web-server.sh . +CMD ./web-server.sh diff --git a/part1/exercise_1.8.txt b/part1/exercise_1.8.txt new file mode 100644 index 0000000..4e0eac6 --- /dev/null +++ b/part1/exercise_1.8.txt @@ -0,0 +1,13 @@ +Dockerfile contentents: + +FROM devopsdockeruh/simple-web-service:alpine +CMD server + + +Command and output: +[devops@devops part1]$ docker run --rm web-server +[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached. + +[GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production. - using env: export GIN_MODE=release - using code: gin.SetMode(gin.ReleaseMode) +[GIN-debug] GET /*path --> server.Start.func1 (3 handlers) +[GIN-debug] Listening and serving HTTP on :8080 diff --git a/part1/exercise_1.9.txt b/part1/exercise_1.9.txt new file mode 100644 index 0000000..cb78adf --- /dev/null +++ b/part1/exercise_1.9.txt @@ -0,0 +1,3 @@ +Command used: + +[devops@devops part1] touch text.log && docker run -v "$(pwd)/text.log:/usr/src/app/text.log" --rm devopsdockeruh/simple-web-service