Skip to content

Hands on guestbook app v1 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions v1/guestbook/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@
# PULL
# WORKDIR


# Dockerfile guestbook app v1
FROM golang:1.15 as builder
RUN go get github.com/codegangsta/negroni
<Please fill in the required Docker command> go get github.com/gorilla/mux github.com/xyproto/simpleredis
# change url to fix simpleredis dependency v2
RUN go get github.com/gorilla/mux github.com/xyproto/simpleredis/v2
COPY main.go .
RUN go build main.go

FROM ubuntu:18.04

<Please fill in the required Docker command> --from=builder /go//main /app/guestbook
<Please fill in the required Docker command> public/index.html /app/public/index.html
<Please fill in the required Docker command> public/script.js /app/public/script.js
<Please fill in the required Docker command> public/style.css /app/public/style.css
<Please fill in the required Docker command> public/jquery.min.js /app/public/jquery.min.js
COPY --from=builder /go//main /app/guestbook
COPY public/index.html /app/public/index.html
COPY public/script.js /app/public/script.js
COPY public/style.css /app/public/style.css
COPY public/jquery.min.js /app/public/jquery.min.js

WORKDIR /app
CMD ["./guestbook"]
<Please fill in the required Docker command> 3000
EXPOSE 3000
7 changes: 3 additions & 4 deletions v1/guestbook/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@ spec:
app: guestbook
spec:
containers:
- image: us.icr.io/<your sn labs namespace>/guestbook:v1
- image: us.icr.io/sn-labs-uwucherer/guestbook:v1
imagePullPolicy: Always
name: guestbook
ports:
- containerPort: 3000
name: http
resources:
limits:
cpu: 50m
cpu: 5m
requests:
cpu: 20m
replicas: 1
cpu: 2m
2 changes: 1 addition & 1 deletion v1/guestbook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"github.com/xyproto/simpleredis"
"github.com/xyproto/simpleredis/v2"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion v1/guestbook/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</head>
<body>
<div id="header">
<h1>Guestbook - v1</h1>
<h1>Guestbook: new index file</h1>
</div>

<div id="guestbook-entries">
Expand Down