k8s: add frontend dockerfile + skaffold
Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
parent
c9f2c89b9c
commit
92eb76c1db
3 changed files with 85 additions and 0 deletions
59
kubernetes-manifests/frontend.yaml
Normal file
59
kubernetes-manifests/frontend.yaml
Normal file
|
@ -0,0 +1,59 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: frontend
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: frontend
|
||||
spec:
|
||||
containers:
|
||||
- name: server
|
||||
image: frontend
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
env:
|
||||
- name: PRODUCT_CATALOG_SERVICE_ADDR
|
||||
value: "productcatalogservice:3550"
|
||||
- name: CURRENCY_SERVICE_ADDR
|
||||
value: "currencyservice:7000"
|
||||
- name: CART_SERVICE_ADDR
|
||||
value: "cartservice:7070"
|
||||
- name: RECOMMENDATION_SERVICE_ADDR
|
||||
value: "recommendationservice:8080"
|
||||
- name: SHIPPING_SERVICE_ADDR
|
||||
value: "shippingservice:50051"
|
||||
- name: CHECKOUT_SERVICE_ADDR
|
||||
value: "checkoutservice:5050"
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: 200m
|
||||
memory: 128Mi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: frontend
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: frontend
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8080
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: frontend-external
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
selector:
|
||||
app: frontend
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8080
|
|
@ -18,6 +18,8 @@ build:
|
|||
workspace: src/currencyservice
|
||||
- imageName: cartservice
|
||||
workspace: src/cartservice
|
||||
- imageName: frontend
|
||||
workspace: src/frontend
|
||||
deploy:
|
||||
kubectl:
|
||||
manifests:
|
||||
|
|
24
src/frontend/Dockerfile
Normal file
24
src/frontend/Dockerfile
Normal file
|
@ -0,0 +1,24 @@
|
|||
FROM golang:1.10-alpine as builder
|
||||
RUN apk add --no-cache ca-certificates git
|
||||
WORKDIR /go/src/frontend
|
||||
COPY . .
|
||||
|
||||
# download known dependencies
|
||||
RUN go get -d github.com/google/uuid \
|
||||
github.com/gorilla/mux \
|
||||
google.golang.org/grpc \
|
||||
google.golang.org/grpc/codes \
|
||||
google.golang.org/grpc/status
|
||||
|
||||
# other dependencies might not have listed above
|
||||
RUN go get -d ./...
|
||||
RUN go build -o /frontend .
|
||||
|
||||
FROM alpine as release
|
||||
RUN apk add --no-cache ca-certificates
|
||||
WORKDIR /frontend
|
||||
COPY --from=builder /frontend /frontend/server
|
||||
COPY ./templates ./templates
|
||||
COPY ./static ./static
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/frontend/server"]
|
Loading…
Reference in a new issue