Skip to content

Instantly share code, notes, and snippets.

View changhuixu's full-sized avatar
💭
Everyone has a happy ending. If you're not happy, it's not the end.

Changhui Xu changhuixu

💭
Everyone has a happy ending. If you're not happy, it's not the end.
View GitHub Profile
version: '3.8'
services:
rabbitmq:
image: rabbitmq:3-management
hostname: my-rabbit
volumes:
- ./rabbitmq/etc/definitions.json:/etc/rabbitmq/definitions.json
- ./rabbitmq/etc/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf
- ./rabbitmq/data:/var/lib/rabbitmq/mnesia/rabbit@my-rabbit
docker run --rm -it --hostname my-rabbit -p 15672:15672 -p 5672:5672 rabbitmq:3-management
version: "3"
services:
api:
build: .
image: aspnetapp
ports:
- "44392:443"
- "54023:80"
environment:
- ASPNETCORE_ENVIRONMENT=Development
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-alpine AS build
WORKDIR /app
COPY *.sln .
COPY MyWebApi/*.csproj ./MyWebApi/
RUN dotnet restore
COPY MyWebApi/. ./MyWebApi/
WORKDIR /app/MyWebApi
RUN dotnet publish -c Release -o /out --no-restore
# in CMD
dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p { password here }
# in PowerShell
dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\aspnetapp.pfx -p { password here }
docker run -it -p 80:80 \
-v /$PWD/dist/angular-nginx-docker://usr/share/nginx/html:ro \
nginx:alpine
curl http://localhost:80/ \
--silent \
--write-out "%{size_download}\n" \
--output /dev/null
# console output: 814
curl http://localhost:80/ \
--silent \
-H "Accept-Encoding: gzip,deflate" \
--write-out "%{size_download}\n" \
docker run -it -p 80:80 \
-v /$PWD/dist/angular-nginx-docker://usr/share/nginx/html:ro \
-v /$PWD/.nginx/nginx.conf://etc/nginx/nginx.conf:ro \
nginx:alpine
# 1. Build our Angular app
FROM node:alpine as builder
WORKDIR /app
COPY package.json package-lock.json ./
ENV CI=1
RUN npm ci
COPY . .
RUN npm run build -- --prod --output-path=/dist
# Run as a less privileged user for security reasons.
user nginx;
# #worker_threads to run;
# "auto" sets it to the #CPU_cores available in the system, and
# offers the best performance.
worker_processes auto;
events { worker_connections 1024; }