From 69b193602ea7867f517722ccd68a2f0419372956 Mon Sep 17 00:00:00 2001 From: Vishwas P <62875653+RealVishy@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:17:38 +0000 Subject: [PATCH 01/15] seperate solutions from workshop demo --- {hello-docker => solutions/hello-docker}/.dockerignore | 0 {hello-docker => solutions/hello-docker}/Cargo.lock | 0 {hello-docker => solutions/hello-docker}/Cargo.toml | 0 {hello-docker => solutions/hello-docker}/Dockerfile.builder | 0 {hello-docker => solutions/hello-docker}/Dockerfile.production | 0 {hello-docker => solutions/hello-docker}/Dockerfile.testing | 0 {hello-docker => solutions/hello-docker}/src/main.rs | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename {hello-docker => solutions/hello-docker}/.dockerignore (100%) rename {hello-docker => solutions/hello-docker}/Cargo.lock (100%) rename {hello-docker => solutions/hello-docker}/Cargo.toml (100%) rename {hello-docker => solutions/hello-docker}/Dockerfile.builder (100%) rename {hello-docker => solutions/hello-docker}/Dockerfile.production (100%) rename {hello-docker => solutions/hello-docker}/Dockerfile.testing (100%) rename {hello-docker => solutions/hello-docker}/src/main.rs (100%) diff --git a/hello-docker/.dockerignore b/solutions/hello-docker/.dockerignore similarity index 100% rename from hello-docker/.dockerignore rename to solutions/hello-docker/.dockerignore diff --git a/hello-docker/Cargo.lock b/solutions/hello-docker/Cargo.lock similarity index 100% rename from hello-docker/Cargo.lock rename to solutions/hello-docker/Cargo.lock diff --git a/hello-docker/Cargo.toml b/solutions/hello-docker/Cargo.toml similarity index 100% rename from hello-docker/Cargo.toml rename to solutions/hello-docker/Cargo.toml diff --git a/hello-docker/Dockerfile.builder b/solutions/hello-docker/Dockerfile.builder similarity index 100% rename from hello-docker/Dockerfile.builder rename to solutions/hello-docker/Dockerfile.builder diff --git a/hello-docker/Dockerfile.production b/solutions/hello-docker/Dockerfile.production similarity index 100% rename from hello-docker/Dockerfile.production rename to solutions/hello-docker/Dockerfile.production diff --git a/hello-docker/Dockerfile.testing b/solutions/hello-docker/Dockerfile.testing similarity index 100% rename from hello-docker/Dockerfile.testing rename to solutions/hello-docker/Dockerfile.testing diff --git a/hello-docker/src/main.rs b/solutions/hello-docker/src/main.rs similarity index 100% rename from hello-docker/src/main.rs rename to solutions/hello-docker/src/main.rs From d96a4747ddd12ad5c538317ff86031ddb97ddd1e Mon Sep 17 00:00:00 2001 From: Vishwas P <62875653+RealVishy@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:04:26 +0000 Subject: [PATCH 02/15] checking if caddy works --- .devcontainer/devcontainer.json | 3 +- solutions/caddy/docker-compose.yml | 8 ++ solutions/caddy/index.html | 146 +++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 solutions/caddy/docker-compose.yml create mode 100644 solutions/caddy/index.html diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b8958b1..8727b0f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,5 +4,6 @@ "ghcr.io/devcontainers/features/docker-in-docker:2": {}, "ghcr.io/devcontainers/features/github-cli:1": {}, "ghcr.io/devcontainers-extra/features/fish-apt-get:1": {} - } + }, + "forwardPorts": [2019] // Forward the host port you’ll use for Caddy } diff --git a/solutions/caddy/docker-compose.yml b/solutions/caddy/docker-compose.yml new file mode 100644 index 0000000..afa8ebe --- /dev/null +++ b/solutions/caddy/docker-compose.yml @@ -0,0 +1,8 @@ +services: + web: + image: caddy:latest + ports: + - "8080:80" # Map port 8080 on the host to port 80 in the container + volumes: + - ./index.html:/usr/share/caddy/index.html # Mount your single index.html file + restart: always # Optional: automatically restart the service if it stops diff --git a/solutions/caddy/index.html b/solutions/caddy/index.html new file mode 100644 index 0000000..fd462b6 --- /dev/null +++ b/solutions/caddy/index.html @@ -0,0 +1,146 @@ + + + +W3.CSS Template + + + + + + + + + + +
+ + +
+ + +
+ +
+
+ Avatar +
+

Jane Doe

+
+
+
+

Designer

+

London, UK

+

ex@mail.com

+

1224435534

+
+ +

Skills

+

Adobe Photoshop

+
+
90%
+
+

Photography

+
+
+
80%
+
+
+

Illustrator

+
+
75%
+
+

Media

+
+
50%
+
+
+ +

Languages

+

English

+
+
+
+

Spanish

+
+
+
+

German

+
+
+
+
+
+

+ + +
+ + +
+ +
+

Work Experience

+
+
Front End Developer / w3schools.com
+
Jan 2015 - Current
+

Lorem ipsum dolor sit amet. Praesentium magnam consectetur vel in deserunt aspernatur est reprehenderit sunt hic. Nulla tempora soluta ea et odio, unde doloremque repellendus iure, iste.

+
+
+
+
Web Developer / something.com
+
Mar 2012 - Dec 2014
+

Consectetur adipisicing elit. Praesentium magnam consectetur vel in deserunt aspernatur est reprehenderit sunt hic. Nulla tempora soluta ea et odio, unde doloremque repellendus iure, iste.

+
+
+
+
Graphic Designer / designsomething.com
+
Jun 2010 - Mar 2012
+

Lorem ipsum dolor sit amet, consectetur adipisicing elit.


+
+
+ +
+

Education

+
+
W3Schools.com
+
Forever
+

Web Development! All I need to know in one place

+
+
+
+
London Business School
+
2013 - 2015
+

Master Degree

+
+
+
+
School of Coding
+
2010 - 2013
+

Bachelor Degree


+
+
+ + +
+ + +
+ + +
+ + + + + From 4aa63a814b986564ecb6fda4fe681b26f15c508c Mon Sep 17 00:00:00 2001 From: Vishwas P <62875653+RealVishy@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:13:24 +0000 Subject: [PATCH 03/15] i have no idea why tf it wants this port --- .devcontainer/devcontainer.json | 3 +-- solutions/caddy/docker-compose.yml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8727b0f..b8958b1 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -4,6 +4,5 @@ "ghcr.io/devcontainers/features/docker-in-docker:2": {}, "ghcr.io/devcontainers/features/github-cli:1": {}, "ghcr.io/devcontainers-extra/features/fish-apt-get:1": {} - }, - "forwardPorts": [2019] // Forward the host port you’ll use for Caddy + } } diff --git a/solutions/caddy/docker-compose.yml b/solutions/caddy/docker-compose.yml index afa8ebe..a5146dc 100644 --- a/solutions/caddy/docker-compose.yml +++ b/solutions/caddy/docker-compose.yml @@ -2,7 +2,7 @@ services: web: image: caddy:latest ports: - - "8080:80" # Map port 8080 on the host to port 80 in the container + - "2019:80" # Map port 8080 on the host to port 80 in the container volumes: - ./index.html:/usr/share/caddy/index.html # Mount your single index.html file restart: always # Optional: automatically restart the service if it stops From fb04bd46bd241358dc716061a8686b0761430a17 Mon Sep 17 00:00:00 2001 From: Vishwas P <62875653+RealVishy@users.noreply.github.com> Date: Tue, 29 Oct 2024 12:45:14 +0000 Subject: [PATCH 04/15] added minecraft --- solutions/minecraft/docker-compose.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 solutions/minecraft/docker-compose.yml diff --git a/solutions/minecraft/docker-compose.yml b/solutions/minecraft/docker-compose.yml new file mode 100644 index 0000000..9f12e67 --- /dev/null +++ b/solutions/minecraft/docker-compose.yml @@ -0,0 +1,14 @@ +services: + mc: + image: itzg/minecraft-server + environment: + EULA: "true" + ports: + - "25565:25565" + volumes: + - data:/data + stdin_open: true + tty: true + restart: unless-stopped +volumes: + data: {} \ No newline at end of file From 66693fc42b0bf9be3a88fb34adac80bc40715038 Mon Sep 17 00:00:00 2001 From: Vishwas P <62875653+RealVishy@users.noreply.github.com> Date: Thu, 31 Oct 2024 08:53:12 +0000 Subject: [PATCH 05/15] add GitHub Actions workflow for building and pushing Docker image --- .github/docker-build-and-push.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/docker-build-and-push.yml diff --git a/.github/docker-build-and-push.yml b/.github/docker-build-and-push.yml new file mode 100644 index 0000000..c321b2b --- /dev/null +++ b/.github/docker-build-and-push.yml @@ -0,0 +1,31 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - adv-docker-example + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GHCR_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + push: true + tags: ghcr.io/${{ github.repository_owner }}/hello-docker:latest From 4197bb839e69cd54d0608eafcdbc729e9bfa7ce0 Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Thu, 31 Oct 2024 20:54:18 +1100 Subject: [PATCH 06/15] using github_token --- .github/docker-build-and-push.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/docker-build-and-push.yml b/.github/docker-build-and-push.yml index c321b2b..acc1778 100644 --- a/.github/docker-build-and-push.yml +++ b/.github/docker-build-and-push.yml @@ -17,11 +17,11 @@ jobs: uses: docker/setup-buildx-action@v1 - name: Log in to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GHCR_TOKEN }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image uses: docker/build-push-action@v3 From 1e07488eab4fc2cbcce58438d6c5e83ca2862179 Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Thu, 31 Oct 2024 20:58:59 +1100 Subject: [PATCH 07/15] move to workflows dir --- .github/{ => workflows}/docker-build-and-push.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{ => workflows}/docker-build-and-push.yml (100%) diff --git a/.github/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml similarity index 100% rename from .github/docker-build-and-push.yml rename to .github/workflows/docker-build-and-push.yml From 3e7169e2441f8bb5ed82e7965ed96b50d20e5518 Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Thu, 31 Oct 2024 21:01:45 +1100 Subject: [PATCH 08/15] uppercase breaks tag --- .github/workflows/docker-build-and-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index acc1778..b1be167 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -28,4 +28,4 @@ jobs: with: context: . push: true - tags: ghcr.io/${{ github.repository_owner }}/hello-docker:latest + tags: ghcr.io/progsoc/hello-docker:latest From 027b4e8c1bfdc1e167b523836f96b40803445f49 Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Thu, 31 Oct 2024 21:05:00 +1100 Subject: [PATCH 09/15] update context --- .github/workflows/docker-build-and-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index b1be167..de9dd89 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -26,6 +26,6 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v3 with: - context: . + context: "{{defaultContext}}:solutions/hello-docker" push: true tags: ghcr.io/progsoc/hello-docker:latest From 0d87f85b69727953d63b1b758505f13f5824da94 Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Thu, 31 Oct 2024 21:10:01 +1100 Subject: [PATCH 10/15] specify Dockerfile --- .github/workflows/docker-build-and-push.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index de9dd89..4a1ba9e 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -26,6 +26,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@v3 with: - context: "{{defaultContext}}:solutions/hello-docker" + context: "./solutions/hello-docker" + file: "./solutions/hello-docker/Dockerfile.production" push: true tags: ghcr.io/progsoc/hello-docker:latest From 80ba248a4cc1f52c03c34da34753245ceb77d9ef Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Thu, 31 Oct 2024 21:11:55 +1100 Subject: [PATCH 11/15] fix tag --- .github/workflows/docker-build-and-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index 4a1ba9e..a60a8ec 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -29,4 +29,4 @@ jobs: context: "./solutions/hello-docker" file: "./solutions/hello-docker/Dockerfile.production" push: true - tags: ghcr.io/progsoc/hello-docker:latest + tags: user/app:latest From 71469cdcfe54cb9d5da3817034d6c63c0baa5d8e Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Thu, 31 Oct 2024 21:18:46 +1100 Subject: [PATCH 12/15] use sanitised tags --- .github/workflows/docker-build-and-push.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index a60a8ec..de4c37c 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -24,9 +24,9 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v6 with: context: "./solutions/hello-docker" file: "./solutions/hello-docker/Dockerfile.production" push: true - tags: user/app:latest + tags: ghcr.io/${{ steps.meta.outputs.tags }}/hello-docker:latest From 4e9d628f210b151020ad2fe7644e0b3de8429b15 Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Thu, 31 Oct 2024 21:20:47 +1100 Subject: [PATCH 13/15] use sanitised tags correctly --- .github/workflows/docker-build-and-push.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index de4c37c..c79c0e2 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -29,4 +29,4 @@ jobs: context: "./solutions/hello-docker" file: "./solutions/hello-docker/Dockerfile.production" push: true - tags: ghcr.io/${{ steps.meta.outputs.tags }}/hello-docker:latest + tags: ${{ steps.meta.outputs.tags }} From 9aacb5f677eee749926d6206c83a3837f03c826d Mon Sep 17 00:00:00 2001 From: Vanilla Viking Date: Thu, 31 Oct 2024 21:24:28 +1100 Subject: [PATCH 14/15] docker meta --- .github/workflows/docker-build-and-push.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index c79c0e2..76cfe4b 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -23,6 +23,13 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{ github.repository }} + tags: latest + - name: Build and push Docker image uses: docker/build-push-action@v6 with: From 9f225499f30ef9917a90d9317c6fc3ca924114c6 Mon Sep 17 00:00:00 2001 From: Vishwas P <62875653+RealVishy@users.noreply.github.com> Date: Fri, 1 Nov 2024 06:27:09 +0000 Subject: [PATCH 15/15] add main branch to docker build and push workflow --- .github/workflows/docker-build-and-push.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index 76cfe4b..2c0ec3c 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -4,6 +4,7 @@ on: push: branches: - adv-docker-example + - main jobs: build: