diff options
author | crupest <crupest@outlook.com> | 2020-06-01 14:51:55 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-06-01 14:51:55 +0800 |
commit | 0d0a419dab2600e5e5e934a572e8200d53b11c0e (patch) | |
tree | d2da99c5ef5252d826b0e0c1f2d06f404e5923df | |
parent | 0c33891dc58aba2648b093b6739c1897d088de1e (diff) | |
download | timeline-0d0a419dab2600e5e5e934a572e8200d53b11c0e.tar.gz timeline-0d0a419dab2600e5e5e934a572e8200d53b11c0e.tar.bz2 timeline-0d0a419dab2600e5e5e934a572e8200d53b11c0e.zip |
Update docker and CI.
-rw-r--r-- | .dockerignore | 7 | ||||
-rw-r--r-- | Dockerfile | 9 | ||||
-rw-r--r-- | Timeline/Dockerfile | 4 | ||||
-rw-r--r-- | azure-pipelines.yml | 33 | ||||
-rw-r--r-- | docker/build-env/Dockerfile | 45 |
5 files changed, 61 insertions, 37 deletions
diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..d0b276f2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.git + +*/bin +*/obj +Timeline/publish +Timeline/ClientApp/dist +Timeline/ClientApp/node_modules diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..49d938df --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM crupest/timeline-build-env:latest AS build +WORKDIR /timeline-app +COPY . . +RUN dotnet publish Timeline/Timeline.csproj --configuration Release --output ./Timeline/publish/ -r linux-x64 --self-contained false + +FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 +WORKDIR /app +COPY --from=build /timeline-app/Timeline/publish . +ENTRYPOINT ["dotnet", "Timeline.dll"] diff --git a/Timeline/Dockerfile b/Timeline/Dockerfile deleted file mode 100644 index 68685a55..00000000 --- a/Timeline/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 -WORKDIR /app -COPY ./publish . -ENTRYPOINT ["dotnet", "Timeline.dll"] diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8f0ee992..80caf9fe 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -55,36 +55,3 @@ stages: inputs:
codeCoverageTool: 'Cobertura'
summaryFileLocation: '**/TestResults/*/coverage.cobertura.xml'
-
-- stage: deploy
- displayName: Build Release and Deploy
- dependsOn: build
- condition: eq(variables['Build.SourceBranchName'], 'master')
- variables:
- buildConfiguration: 'Release'
-
- jobs:
- - job: build
- displayName: Build Release Artifact
- pool:
- vmImage: 'ubuntu-18.04'
- steps:
- - task: UseDotNet@2
- inputs:
- packageType: sdk
- version: 3.1.x
-
- - script: dotnet publish Timeline/Timeline.csproj --configuration $(buildConfiguration) --output ./Timeline/publish/ -r linux-x64 --self-contained false
- displayName: Dotnet Publish
-
- - publish: Timeline/publish
- artifact: timeline
-
- - task: Docker@2
- displayName: Build And Push Docker Image
- inputs:
- command: buildAndPush
- repository: crupest/timeline
- tags: latest
- buildContext: Timeline
- containerRegistry: crupest-docker-hub
diff --git a/docker/build-env/Dockerfile b/docker/build-env/Dockerfile new file mode 100644 index 00000000..1fbd8597 --- /dev/null +++ b/docker/build-env/Dockerfile @@ -0,0 +1,45 @@ +FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster + +ENV NODE_VERSION 14.3.0 + +RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \ + && case "${dpkgArch##*-}" in \ + amd64) ARCH='x64';; \ + ppc64el) ARCH='ppc64le';; \ + s390x) ARCH='s390x';; \ + arm64) ARCH='arm64';; \ + armhf) ARCH='armv7l';; \ + i386) ARCH='x86';; \ + *) echo "unsupported architecture"; exit 1 ;; \ + esac \ + # gpg keys listed at https://github.com/nodejs/node#release-keys + && set -ex \ + && for key in \ + 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \ + FD3A5288F042B6850C66B31F09FE44734EB7990E \ + 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \ + DD8F2338BAE7501E3DD5AC78C273792F7D83545D \ + C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \ + B9AE9905FFD7803F25714661B63B535A4C206CA9 \ + 77984A986EBC2AA786BC0F66B01FBB92821C587A \ + 8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \ + 4ED778F539E3634C779C87C6D7062848A1AB005C \ + A48C2BEE680E841632CD4E44F07496B3EB3C1762 \ + B9E2F5981AA6E0CD28160D9FF13993A75599653C \ + ; do \ + gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \ + gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \ + gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \ + done \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.gz" \ + && curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \ + && gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \ + && grep " node-v$NODE_VERSION-linux-$ARCH.tar.gz\$" SHASUMS256.txt | sha256sum -c - \ + && tar -xzf "node-v$NODE_VERSION-linux-$ARCH.tar.gz" -C /usr/local --strip-components=1 --no-same-owner \ + && rm "node-v$NODE_VERSION-linux-$ARCH.tar.gz" SHASUMS256.txt.asc SHASUMS256.txt \ + && ln -s /usr/local/bin/node /usr/local/bin/nodejs \ + && npm i -g yarn \ + # smoke tests + && node --version \ + && npm --version \ + && yarn --version |