...
 
Commits (8)
# directories
**/.git/
**/.idea/
**/.vscode/
**/node_modules/
**/dist/
**/bin/
**/obj/
**/out/
# ignore everything
**/*
# files
**/Dockerfile*
**/.dockerignore
**/.gitignore
**/.gitlab-ci.yml
**/*.md
**/*.user
**/launchSettings.json
# except publish output directory
!SafireDashboard/out/
......@@ -23,6 +23,7 @@ bin/
Bin/
obj/
Obj/
out/
# Visual Studio 2015 cache/options directory
.vs/
......
......@@ -2,8 +2,6 @@ stages:
- build
- release
image: docker:19.03
variables:
# When using dind service, we need to instruct docker, to talk with
# the daemon started inside of the service. The daemon is available
......@@ -30,25 +28,44 @@ variables:
IMAGE_TAG: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}
IMAGE_COMMIT: ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}
services:
- docker:19.03-dind
before_script:
# login to docker registry
- echo -n ${CI_REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
after_script:
# logout of docker registry
- docker logout ${CI_REGISTRY}
build:
stage: build
image: gitlab.atb-bremen.de:5555/atb/docker-base-images/dotnet-core-sdk-2.2-nodejs-10:1
cache:
untracked: false
policy: push
paths:
- SafireDashboard/out
- Dockerfile
- .dockerignore
script:
- dotnet publish -c Release -o out SafireDashboard/SafireDashboard.csproj
- ls -alR SafireDashboard/out
release-dev:
stage: release
image: docker:19.03
tags:
# run on docker-in-docker GitLab Runner
- dind
image: docker:19.03
cache:
untracked: false
policy: pull
paths:
- SafireDashboard/out
- Dockerfile
- .dockerignore
services:
- docker:19.03-dind
before_script:
# login to docker registry
- echo -n ${CI_REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
after_script:
# logout of docker registry
- docker logout ${CI_REGISTRY}
script:
- ls -alR SafireDashboard/out
# fetches the latest image (not failing if image is not found)
- docker pull ${IMAGE_LATEST} || true
# build docker image
......@@ -68,6 +85,14 @@ release-master:
variables:
# We are just using docker here and do not need GitLab to clone the source code
GIT_STRATEGY: none
services:
- docker:19.03-dind
before_script:
# login to docker registry
- echo -n ${CI_REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
after_script:
# logout of docker registry
- docker logout ${CI_REGISTRY}
script:
# pull image again
- docker pull ${IMAGE_COMMIT}
......@@ -91,6 +116,14 @@ release-tag:
variables:
# We are just using docker here and do not need GitLab to clone the source code
GIT_STRATEGY: none
services:
- docker:19.03-dind
before_script:
# login to docker registry
- echo -n ${CI_REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
after_script:
# logout of docker registry
- docker logout ${CI_REGISTRY}
script:
# pull image again
- docker pull ${IMAGE_COMMIT}
......
FROM gitlab.atb-bremen.de:5555/atb/docker-base-images/dotnet-core-sdk-2.2-nodejs-10:1 AS build
# copy csproj and restore as distinct layers
WORKDIR /app
COPY *.sln .
COPY SafireDashboard/*.csproj ./SafireDashboard/
COPY KafkaTestProducer/*.csproj ./KafkaTestProducer/
RUN dotnet restore
# copy everything else and build app
COPY SafireDashboard/. ./SafireDashboard/
WORKDIR /app/SafireDashboard
RUN dotnet publish -c Release -o out
# build runtime image using "out" directory from build image
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS runtime
WORKDIR /app
COPY --from=build /app/SafireDashboard/out/ ./
COPY SafireDashboard/out/ ./
ENTRYPOINT ["dotnet", "SafireDashboard.dll"]