diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9635d8d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM gcc:latest + +WORKDIR /app + +COPY bin/hello_world /app/ + +CMD ["bin/hello_world"] diff --git a/README.md b/README.md index 74c112d..f7aeaaa 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,2 @@ # Docker-Test -Just testing Docker together with C++ \ No newline at end of file diff --git a/bin/Test b/bin/Test new file mode 100755 index 0000000..5f995f8 Binary files /dev/null and b/bin/Test differ diff --git a/makefile b/makefile new file mode 100644 index 0000000..deb8de8 --- /dev/null +++ b/makefile @@ -0,0 +1,27 @@ +# Makefile for hello.c + +CC = g++ # C compiler +CFLAGS = -O2 # Compiler flags (optimization level) + +SRC_DIR = src +BUILD_DIR = build +BIN_DIR = bin +EXECUTABLE = Test + +# Create directories +$(shell mkdir -p $(BUILD_DIR) $(BIN_DIR)) + +SOURCES = $(wildcard $(SRC_DIR)/*.cpp) +OBJECT_FILES = $(SOURCES:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o) + +$(BIN_DIR)/$(EXECUTABLE): $(OBJECT_FILES) + $(CC) $(CFLAGS) -o $@ $^ + +$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp + $(CC) $(CFLAGS) -c $< -o $@ + +run: + $(BIN_DIR)/$(EXECUTABLE) + +clean: + rm -f $(BUILD_DIR)/*.o $(BIN_DIR)/* diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..5f3fe83 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main() { + std::cout << "Hello, World!" << std::endl; + return 0; +}