From 97295c293c19288b961714dee34d9bc9f1763687 Mon Sep 17 00:00:00 2001 From: Niggl1999 Date: Tue, 26 May 2020 17:47:16 +0200 Subject: [PATCH 1/4] Added basic dockerfile for running the ASP.Net core App --- Dockerfile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..61104bf --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file From 84866c9bdc2618d592db10e7e9926d5cf6cdedb6 Mon Sep 17 00:00:00 2001 From: Niggl1999 Date: Tue, 26 May 2020 17:52:28 +0200 Subject: [PATCH 2/4] Added basic docker-compose file to run the backend alongside a database --- docker-compose.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..82bc078 --- /dev/null +++ b/docker-compose.yml @@ -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: \ No newline at end of file From 3c5927a6be41b83c63bf8b22cf2ea384cb239c22 Mon Sep 17 00:00:00 2001 From: Niggl1999 Date: Tue, 26 May 2020 18:19:47 +0200 Subject: [PATCH 3/4] Added basic instructions for running w/docker --- README.md | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 53dd41d..766c5ff 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,28 @@ -# BAckend - +# Backend + +## Deploy with Docker +> Prerequisite: Docker and Docker Compose have to be installed on your system
+> The Docker installation instructions for most operation systems can be found here: [https://docs.docker.com/get-docker/](https://docs.docker.com/get-docker/)
+> 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 .` +4. Tell Docker to run the app on port 8080 with `docker run -p 8080:80 taskboard` + +Other useful commands: +* Run detached: `docker run -d -p 8080:80 taskboard` +* Run under specified name: `docker run -p 8080:80 --name myapp taskboard` \ No newline at end of file From da53c9d25f0f6fcc970e16df8d91d7b15706ce91 Mon Sep 17 00:00:00 2001 From: Niggl1999 Date: Tue, 2 Jun 2020 15:51:05 +0200 Subject: [PATCH 4/4] Changed proposed naming scheme for the docker image name --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 766c5ff..d61f4ff 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,9 @@ Other useful commands: ### 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 .` -4. Tell Docker to run the app on port 8080 with `docker run -p 8080:80 taskboard` +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` -* Run under specified name: `docker run -p 8080:80 --name myapp taskboard` \ No newline at end of file +* Run detached: `docker run -d -p 8080:80 taskboard_backend` +* Run under specified name: `docker run -p 8080:80 --name backend taskboard_backend` \ No newline at end of file