This file contains hidden or 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
build_image: | |
image: docker:git | |
services: | |
- docker:dind | |
script: | |
# Login to Gitlab Registry | |
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com | |
# Build image | |
- docker build -t registry.gitlab.com/<username>/<repo-name>/<docker-name>:latest --build-arg env=sandbox --build-arg <SOME-ARG>=<VALUE> . | |
# Then push image |
This file contains hidden or 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
namespace Demo.WebApi.Controllers | |
{ | |
// SIMPLE AUTHORIZATION | |
[Authorize] | |
[Route("api/[controller]")] | |
public class AccountController : Controller | |
{ | |
public AccountController() | |
{ | |
} |
This file contains hidden or 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
version: '2' | |
services: | |
sandbox.web: | |
build: | |
context: . | |
args: | |
env: sandbox | |
ports: | |
- "8080:80" | |
app.web: |
This file contains hidden or 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
worker_processes 1; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
server { | |
listen 80; | |
server_name localhost; |
This file contains hidden or 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
{ | |
// ... | |
"scripts": { | |
"ng": "ng", | |
"start": "ng serve & gulp watch", | |
"serve": "ng serve --sourcemap=false --verbose", | |
"build:prod": "ng build --env=prod --prod --build-optimizer", | |
"build:sandbox": "ng build --env=sandbox ---prod --build-optimizer", | |
}, | |
// ... |
This file contains hidden or 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
# The builder from node image | |
FROM node:alpine as builder | |
# build-time variables | |
# prod|sandbox its value will be come from outside | |
ARG env=prod | |
RUN apk update && apk add --no-cache make git | |
# Move our files into directory name "app" |
This file contains hidden or 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
export const environment = { | |
production: true, | |
config: { | |
host: 'https://api.xxx.xxx/api' | |
// more config | |
} | |
}; |
This file contains hidden or 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
version: '3' | |
services: | |
staging.api: | |
build: . | |
ports: | |
- "5000:80" | |
environment: | |
- ASPNETCORE_ENVIRONMENT=Staging | |
production.api: |
This file contains hidden or 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 microsoft/aspnetcore-build:2.0 AS build-env | |
WORKDIR /app | |
# Copy csproj and restore as distinct layers | |
COPY *.csproj ./ | |
RUN dotnet restore | |
# Copy everything else and build | |
COPY . ./ | |
RUN dotnet publish -c Release -o out |
This file contains hidden or 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
public partial class Startup | |
{ | |
public Startup(IHostingEnvironment env) | |
{ | |
var builder = new ConfigurationBuilder() | |
.SetBasePath(env.ContentRootPath) | |
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: false, reloadOnChange: true) | |
.AddEnvironmentVariables(); | |
Configuration = builder.Build(); | |
} |
NewerOlder