Skip to content

Commit 8ec2cff

Browse files
committed
Update the deployment settings and documentation
1 parent 08dd8f2 commit 8ec2cff

7 files changed

Lines changed: 94 additions & 270 deletions

File tree

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*/bin/
2+
*/obj/
3+
4+
/node_modules/

.teamcity/pom.xml

Lines changed: 0 additions & 104 deletions
This file was deleted.

.teamcity/settings.kts

Lines changed: 0 additions & 103 deletions
This file was deleted.

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
2+
RUN apt-get update && apt-get install -y git nodejs npm
3+
RUN npm install npm@6.14.6 -g
4+
5+
WORKDIR /app
6+
7+
COPY *.json ./
8+
RUN npm ci
9+
RUN npm run build
10+
11+
COPY Codingteam.Site/*.fsproj ./Codingteam.Site
12+
RUN dotnet restore Codingteam.Site
13+
14+
COPY Codingteam.Site ./Codingteam.Site
15+
RUN dotnet build --no-restore --configuration Release Codingteam.Site
16+
RUN dotnet publish --no-build --configuration Release --output publish Codingteam.Site
17+
18+
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1
19+
WORKDIR /app
20+
21+
COPY --from=build-env /app/publish .
22+
23+
ENTRYPOINT ["dotnet", "Codingteam.Site.dll"]

Readme.md

Lines changed: 65 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
codingteam.org.ru
1+
codingteam.org.ru [![Docker Image][badge.docker]][docker-hub]
22
=================
33

44
This is the code that services [codingteam.org.ru][] website.
55

6-
### Prerequisites
6+
Prerequisites
7+
-------------
78

89
To build the application, you'll need to install [.NET Core SDK][dotnet]
9-
3.1.201+ and [Node.js][node-js] 6.14+.
10+
3.1.201+ and [NPM][npm] 6.14+.
1011

1112
To run the application, [.NET Core Runtime][dotnet] 3.1 is required.
1213

13-
### Configuration
14+
Configure
15+
---------
1416

1517
The only configuration parameter is the HTTP binding. Change the binding using
1618
`ASPNETCORE_URLS` environment variable. For example,
@@ -27,7 +29,8 @@ You may specify the application settings in the `appsettings.json` file. The
2729
},
2830
```
2931

30-
### Building
32+
Build
33+
-----
3134

3235
Prepare for the build (set the dependencies up):
3336

@@ -42,33 +45,78 @@ $ npm run build
4245
$ dotnet build
4346
```
4447

45-
Execute the local build:
48+
Run
49+
---
4650

4751
```console
4852
$ dotnet run --project Codingteam.Site
4953
```
5054

51-
Prepare the production-ready package:
55+
Test
56+
----
57+
58+
To run the project tests, execute the following command:
5259

5360
```console
54-
$ dotnet publish -c release
61+
$ dotnet test --configuration Release
5562
```
5663

57-
### Test
64+
Publish
65+
-------
5866

59-
To run the project tests, execute the following command:
67+
Prepare the production-ready distribution in the `publish` directory:
68+
69+
```console
70+
$ dotnet publish --configuration Release --output publish Codingteam.Site
71+
```
72+
73+
This application uses Docker for deployment. To create a Docker image, use the
74+
following command:
75+
76+
```console
77+
$ docker build -t revenrof/codingteam.org.ru:$CODINGTEAM_ORG_RU_VERSION -t revenrof/codingteam.org.ru:latest .
78+
```
79+
80+
(where `$CODINGTEAM_ORG_RU_VERSION` is the version for the image to use)
81+
82+
Then push the image to the Docker Hub:
6083

6184
```console
62-
$ dotnet test
85+
$ docker login # if necessary
86+
$ docker push revenrof/codingteam.org.ru:$CODINGTEAM_ORG_RU_VERSION
87+
$ docker push revenrof/codingteam.org.ru:latest
6388
```
6489

65-
### Deployment
90+
Deploy
91+
------
92+
93+
To install the application from Docker, run the following command:
94+
95+
```console
96+
$ docker run -d --restart unless-stopped -p:$PORT:80 --name $NAME -v $CONFIG:/app/appsettings.json revenrof/codingteam.org.ru:$VERSION
97+
```
98+
99+
Where
100+
- `$PORT` is the port you want to expose the application on
101+
- `$NAME` is the container name
102+
- `$CONFIG` is the **absolute** path to the configuration file override (if
103+
necessary)
104+
- `$VERSION` is the version you want to deploy, or `latest` for the latest
105+
available one
106+
107+
For example, a production server may use the following settings (note this
108+
command uses the Bash syntax; adapt for your shell if necessary):
109+
110+
```bash
111+
PORT=5000
112+
NAME=codingteam.org.ru
113+
VERSION=latest
114+
docker run -d --restart unless-stopped -p $PORT:80 --name $NAME revenrof/codingteam.org.ru:$VERSION
115+
```
66116

67-
The site can be deployed to any platform capable of running [dotnet][]. See
68-
[deployment documentation][deployment] for information about current production
69-
environment.
117+
[badge.docker]: https://img.shields.io/docker/v/revenrof/codingteam.org.ru?sort=semver
70118

71119
[codingteam.org.ru]: https://codingteam.org.ru/
72-
[deployment]: docs/deployment.md
120+
[docker-hub]: https://hub.docker.com/r/revenrof/codingteam.org.ru
73121
[dotnet]: https://dot.net/
74-
[node-js]: https://nodejs.org/en/
122+
[npm]: https://npmjs.com

codingteam.org.ru.sln

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1111
ProjectSection(SolutionItems) = preProject
1212
package.json = package.json
1313
Readme.md = Readme.md
14+
Dockerfile = Dockerfile
15+
.dockerignore = .dockerignore
1416
EndProjectSection
1517
EndProject
1618
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{339BA2DC-3628-4E8E-98CC-264B5A3625AA}"

0 commit comments

Comments
 (0)