Last active
June 24, 2019 12:10
-
-
Save riezebosch/b2a06e9398a456e390839a4f251ee82f to your computer and use it in GitHub Desktop.
containerization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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