Rest of part 1 exercises
This commit is contained in:
parent
936da27d8b
commit
cc6da85490
9 changed files with 81 additions and 0 deletions
8
part1/exercise_1.10.txt
Normal file
8
part1/exercise_1.10.txt
Normal file
|
@ -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":"/"}
|
8
part1/exercise_1.11.txt
Normal file
8
part1/exercise_1.11.txt
Normal file
|
@ -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"]
|
8
part1/exercise_1.12.txt
Normal file
8
part1/exercise_1.12.txt
Normal file
|
@ -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"]
|
6
part1/exercise_1.13.txt
Normal file
6
part1/exercise_1.13.txt
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
FROM golang:1.16
|
||||||
|
EXPOSE 8080
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
COPY . .
|
||||||
|
RUN go build
|
||||||
|
CMD ["./server"]
|
24
part1/exercise_1.14.txt
Normal file
24
part1/exercise_1.14.txt
Normal file
|
@ -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"]
|
4
part1/exercise_1.6.txt
Normal file
4
part1/exercise_1.6.txt
Normal file
|
@ -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"
|
7
part1/exercise_1.7.txt
Normal file
7
part1/exercise_1.7.txt
Normal file
|
@ -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
|
13
part1/exercise_1.8.txt
Normal file
13
part1/exercise_1.8.txt
Normal file
|
@ -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
|
3
part1/exercise_1.9.txt
Normal file
3
part1/exercise_1.9.txt
Normal file
|
@ -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
|
Reference in a new issue