Skip to content

Instantly share code, notes, and snippets.

@riezebosch riezebosch/Dockerfile
Last active Jun 24, 2019

Embed
What would you like to do?
containerization
FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build-env
WORKDIR /app
RUN dotnet new webapi
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/core/aspnet
ENV ASPNETCORE_URLS http://+:80
EXPOSE 80
WORKDIR /app
COPY --from=build-env /app/out ./
ENTRYPOINT ["dotnet", "app.dll"]
apiVersion: v1
kind: Pod
metadata:
name: html
labels:
app: demo
name: html
spec:
containers:
- name: html
image: localhost:5000/html
ports:
- name: http
containerPort: 80
---
kind: Service
apiVersion: v1
metadata:
name: html
spec:
selector:
app: demo
name: html
ports:
- protocol: TCP
port: 80
targetPort: http
<html>
<head>
</head>
<body>
<h1>hallo!</h1>
<button onclick="fetch('/api/values')
.then(response => response.json())
.then(data => document.getElementById('list').innerHTML = data.map(element => `<li>${element}</li>`).join(''))">fetch!</button>
<ul id="list">
</ul>
</body>
</html>
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test-ingress
annotations:
kubernetes.io/ingress.class: nginx
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
rules:
- http:
paths:
- path: /api/
backend:
serviceName: api
servicePort: 80
- path: /
backend:
serviceName: html
servicePort: 80
events { }
http {
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
proxy_pass http://html/;
}
location /api/ {
proxy_pass http://api/api/;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.