Skip to content

Commit ef9e8a7

Browse files
committed
Refactor Minecraft server setup and remove deprecated files
- Updated `compose.yaml` for Minecraft server to correct port mapping and environment variables. - Deleted obsolete `docker-compose.yaml` for Minecraft server. - Removed unused K-Pop web server files including `compose.yaml` and `index.html`. - Added a new Dockerfile for a Hello World Rust application using multi-stage builds. - Created a README for K-Pop server quest with instructions for setting up a web server. - Added `index.html` for K-Pop server showcasing rivalry between BTS and Blackpink. - Established a local development environment Dockerfile with essential tools and dependencies. - Implemented a Caddy-based web server for K-Pop content with Docker Compose configuration.
1 parent 3480ba8 commit ef9e8a7

File tree

15 files changed

+396
-48
lines changed

15 files changed

+396
-48
lines changed

.github/workflows/docker-build-and-push.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,32 @@ jobs:
2323
username: ${{ github.actor }}
2424
password: ${{ secrets.GITHUB_TOKEN }}
2525

26-
- name: Docker meta
27-
id: meta
26+
- name: Docker meta - Demo
27+
id: meta-demo
2828
uses: docker/metadata-action@v4
2929
with:
30-
images: ghcr.io/${{ github.repository }}
30+
images: ghcr.io/${{ github.repository }}/demo
3131
tags: latest
3232

33-
- name: Build and push Docker image
33+
- name: Build and push Demo Docker image
3434
uses: docker/build-push-action@v6
3535
with:
3636
context: "./demo"
3737
file: "./demo/Dockerfile.production"
3838
push: true
39-
tags: ${{ steps.meta.outputs.tags }}
39+
tags: ${{ steps.meta-demo.outputs.tags }}
40+
41+
- name: Docker meta - K-pop Demon Server
42+
id: meta-kpop
43+
uses: docker/metadata-action@v4
44+
with:
45+
images: ghcr.io/${{ github.repository }}/kpop-web-server
46+
tags: latest
47+
48+
- name: Build and push K-pop Web Server Docker image
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: "./quests/solutions/kpop-web-server"
52+
file: "./quests/solutions/kpop-web-server/Dockerfile"
53+
push: true
54+
tags: ${{ steps.meta-kpop.outputs.tags }}

demo/src/main.rs

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
use std::io;
2+
3+
fn is_leap_year(year: i32) -> bool {
4+
// A year is a leap year if:
5+
// 1. It's divisible by 4 AND not divisible by 100
6+
// OR
7+
// 2. It's divisible by 400
8+
(year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)
9+
}
10+
111
fn main() {
2-
println!("Hello, Docker!");
12+
println!("🗓️ Leap Year Checker 🗓️");
13+
println!("========================");
14+
15+
loop {
16+
println!("\nEnter a year (or 'q' to quit):");
17+
print!("> ");
18+
19+
let mut input = String::new();
20+
io::stdin()
21+
.read_line(&mut input)
22+
.expect("Failed to read line");
23+
24+
let input = input.trim();
25+
26+
// Check if user wants to quit
27+
if input.to_lowercase() == "q" || input.to_lowercase() == "quit" {
28+
println!("👋 Goodbye!");
29+
break;
30+
}
31+
32+
// Parse the year
33+
let year: i32 = match input.parse() {
34+
Ok(num) => num,
35+
Err(_) => {
36+
println!("❌ Invalid input! Please enter a valid year.");
37+
continue;
38+
}
39+
};
40+
41+
// Check if it's a leap year
42+
if is_leap_year(year) {
43+
println!("✅ {} is a LEAP YEAR! 🎉", year);
44+
println!(" It has 366 days (February has 29 days).");
45+
} else {
46+
println!("❌ {} is NOT a leap year.", year);
47+
println!(" It has 365 days (February has 28 days).");
48+
}
49+
}
350
}

quests/hello-docker/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Write a sample dockerfile to run this Hello World Rust application
2+
# The application is a simple command line program that prints "Hello, Docker!" to the console
3+
# Use multi-stage builds to keep the final image small
4+
5+
6+
# Look at demo/Dockerfile.production for reference
7+
8+
FROM rust:latest AS builder

quests/kpop-web-server/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# K-Pop Server Quest
2+
3+
In this quest, you'll write a Dockerfile and Docker Compose to setup a K-Pop Web Server. You can use any web server image of your choice (e.g., Nginx, Apache) and create a simple HTML page that showcases the rivalry between BTS and Blackpink.
File renamed without changes.

quests/local-dev-env/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM scratch

quests/local-dev-env/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Local Development Environment Quest
2+
3+
In this quest, you'll create a Dockerfile to set up a local development environment for a specific application. The goal is to create a lightweight and efficient Docker image that can be used for development purposes with all necessary tools and dependencies installed.

quests/minecraft/compose.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# This file defines how to run the Minecraft server container
33

44
services: # List of services (containers) to run
5-
mc: # Name of the service - you can reference it with 'docker compose logs mc'
6-
image: itzg/minecraft-server # The Docker image to use from Docker Hub
7-
tty: true # Allocate a pseudo-TTY (allows interactive terminal)
8-
stdin_open: true # Keep STDIN open (allows you to type server commands)
9-
ports: # Maps ports from host machine to container
5+
mc:
6+
image: itzg/minecraft-server
7+
tty: true
8+
stdin_open: true
9+
ports:
1010
- "25565:25566" # Format: "host_port:container_port"
1111
environment: # Environment variables passed to the container
12-
EULA: "FALSE" # Must be TRUE to accept Minecraft EULA
13-
TYPE: "VANILLA" # The type of Minecraft server (VANILLA, PAPER, FORGE, etc.)
12+
EULA: "FALSE"
13+
TYPE: "VANILLA"
1414
volumes: # Mount directories from host to container to persist data
1515
- ./data:/data # Stores world data, plugins, configs in ./data folder
1616

quests/minecraft/docker-compose.yaml

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

quests/solutions/kpop-demon-server/compose.yaml

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

0 commit comments

Comments
 (0)