Merge branch 'deployment' into 'master'

Deployment

See merge request scrum-taskboard/backend!2
This commit is contained in:
ortni79929 2020-06-03 19:14:36 +02:00
commit cd664f7c38
3 changed files with 68 additions and 2 deletions

13
Dockerfile Normal file
View File

@ -0,0 +1,13 @@
# Stage 1: Build
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /build
COPY . .
RUN dotnet restore
RUN dotnet publish -c Release -o /app
# Stage 2: Package up and set entrypoint
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS final
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "ScrumTaskboard.dll"]

View File

@ -1,2 +1,28 @@
# BAckend
# Backend
## Deploy with Docker
> Prerequisite: Docker and Docker Compose have to be installed on your system </br>
> The Docker installation instructions for most operation systems can be found here: [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/) </br>
> The Docker Compose installation instructions for most operation systems can be found here: [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)
### Quick Deployment with Docker Compose
1. Clone the git repo
2. Open the cloned repo's folder in a shell of your choice (as long as it supports Docker)
3. Tell Docker Compose to build - if it hasn't already been built - and run the app with `docker-compose up`
Other useful commands:
* Just build: `docker-compose build`
* Build before running: `docker-compose up --build`
* Run attached (in the background): `docker-compose up -d`
* Stop: `docker-compose down`
* Restart: `docker-compose restart`
### Build the Container yourself (and run it)
1. Clone the git repo
2. Open the cloned repo's folder in a shell of your choice (as long as it supports Docker)
3. Tell Docker to build the app under the name "taskboard" with `docker build -t taskboard_backend .`
4. Tell Docker to run the app on port 8080 with `docker run -p 8080:80 taskboard_backend`
Other useful commands:
* Run detached: `docker run -d -p 8080:80 taskboard_backend`
* Run under specified name: `docker run -p 8080:80 --name backend taskboard_backend`

27
docker-compose.yml Normal file
View File

@ -0,0 +1,27 @@
version: "3"
services:
db:
image: postgres:11-alpine
environment:
POSTGRES_DB: taskboard
POSTGRES_PASSWORD: c6gXud7YvBWp2sgxSgy4wRN
POSTGRES_USER: scrum
restart: unless-stopped
volumes:
- db-data:/var/lib/postgresql/data
networks:
- default
app:
build:
context: .
restart: unless-stopped
depends_on:
- db
networks:
- default
ports:
- "8080:80"
volumes:
db-data: