A simple web based application that prints a message on a coloured background, both of which can be configured using environment variables.
To start the web application, configure each of the following environment variables:
HOSTPORT=0.0.0.0:8080MESSAGE=CloudAcademyBACKGROUND_COLOR=yellowThe web application has been packaged into a Docker image. The Docker image can be pulled with the following command:
docker pull cloudacademydevops/webappecho:v3
Use the following command to launch the web echoing application within Docker:
docker run --name webapp --env MESSAGE=CloudAcademy --env BACKGROUND_COLOR=yellow -p 8080:8080 --detach cloudacademydevops/webappecho:v3
Use the following command to launch the web echoing application as a Deployment resource within a cluster:
cat << EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend-v1
namespace: webapp
labels:
role: frontend
version: v1
spec:
replicas: 2
selector:
matchLabels:
role: frontend
version: v1
template:
metadata:
labels:
role: frontend
version: v1
spec:
containers:
- name: webapp
image: cloudacademydevops/webappecho:v3
imagePullPolicy: IfNotPresent
command: ["/go/bin/webapp"]
ports:
- containerPort: 8080
env:
- name: MESSAGE
valueFrom:
configMapKeyRef:
name: webapp-cfg-v1
key: message
- name: BACKGROUND_COLOR
valueFrom:
configMapKeyRef:
name: webapp-cfg-v1
key: bgcolor
EOF
https://github.com/cloudacademy/web-echo-app
The docker image was built with the following command:
docker buildx build --platform=linux/amd64 -t cloudacademydevops/webappecho:v2 .
Content type
Image
Digest
sha256:0d0ad67ad…
Size
4.7 MB
Last updated
almost 3 years ago
docker pull cloudacademydevops/webappecho