This repository contains a simple Go application that serves a "Hello World" message through an HTTP server. The project is Dockerized to facilitate containerization and deployment to platforms like Docker Hub or Render.
The directory structure of the project is as follows:
Go_holamundo/ β βββ Dockerfile # Instructions for Docker to build the application container βββ go.mod # Go module file, contains project dependencies βββ go.sum # Go sum file, ensures correct versions of dependencies βββ main.go # Main Go application file that runs the HTTP server
git clone https://github.com/Carlosdhc333/Go_holamundo.gitβ
2.- Navigate to the project directory:
cd Go_holamundo
3.- Initialize the Go module and download dependencies:
go mod tidy
To run the Go application on your local machine, use the following command:
go run main.go
This will start an HTTP server on port 8080. You can access it by navigating to http://localhost:8080β in your web browser.
To build and run the application inside a Docker container, follow these steps:
1.- Build the Docker image:
docker build -t carlosdhc333/go_holamundo:v1 .
2.- Run the Docker container:
docker run --rm -p 8080:8080 carlosdhc333/go_holamundo:v1
This will make the application available on http://localhost:8080β inside the container
If you'd like to share the Docker image, you can push it to Docker Hub:
1.- Log in to Docker Hub:
docker login
2.- Tag the image:
docker tag carlosdhc333/go_holamundo:v1 your_username/go_holamundo
3.- Push the image to Docker Hub:
docker push your_username/go_holamundo
To deploy this project on Render:
1.- Upload the repository to GitHub.
2.- In the Render dashboard, click on "New" > "Web Service" and connect your GitHub repository.
3.- Set the command to run your application, such as go run main.go.
Render will build the Docker image and run the application, displaying the output in the service log.
Feel free to fork this repository and submit pull requests if you want to contribute to improving this project.
This project is licensed under the MIT License.
You can now copy and paste this markdown into your repositoryβs README.md file. Let me know if you need any further help!
Content type
Image
Digest
sha256:ac82c66d7β¦
Size
95 MB
Last updated
almost 2 years ago
docker pull carlosdhc333/go_holamundo:v1