Created
February 12, 2018 23:50
-
-
Save denmerc/9d2111aaf9b0f15a2edee12dfd240288 to your computer and use it in GitHub Desktop.
.net core with Docker
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
nginx: | |
build: ./nginx | |
links: | |
- kestrel:kestrel | |
ports: | |
- "80:80" | |
kestrel: | |
build: . | |
ports: | |
- "5000" | |
# docker-compose up | |
# transfer | |
# docker images | |
# docker save -0 helloworld.tar helloworld | |
# -THEN- | |
# docker load -i helloworld.tar | |
# -OR- | |
# docker login | |
# docker build -t user/helloworld . | |
# docker push user/helloworld | |
# -THEN- | |
# docker pull user/helloworld |
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
# "Dockerfile" to save w/o extension | |
FROM microsoft/dotnet:latest | |
COPY . /app | |
WORKDIR / | |
RUN dotnet restore | |
RUN dotnet build | |
EXPOSE 5000/tcp | |
ENV ASPNETCORE_URLS http://*:5000 | |
ENTRYPOINT dotnet run | |
# build | |
# docker build -t hellowworld . | |
# test | |
# docker run -it -p 5000 helloworld | |
# run in prod manually | |
# docker run -d -p 5000:5000 helloworld | |
# docker ps |
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 nginx | |
COPY nginx.conf /etc/nginx/nginx.conf |
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 { worker_connections 1024;} | |
http { | |
server { | |
listen 80; | |
location / { | |
proxy_pass http://kestrel:5000; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection 'keep-alive'; | |
proxy_set_header Host $host; | |
proxy_cache_bypass $http_upgrade; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment