Skip to content

Commit

Permalink
feature: Update Dockerfile for simplified Go application build (#5)
Browse files Browse the repository at this point in the history
## Description

<!-- 
Please do not leave this blank 
This PR [adds/removes/fixes/replaces] the [feature/bug/etc]. 
-->

1. This pull request updates the Dockerfile to simplify the build
process for the Go application

2. This pull request references the existing project description for
additional details on how to use the project:

- Prerequisites (Git, Docker)
- Cloning the Repository (Git commands)
- Building the Image (Docker build command)
- Running the Image (Docker run command)

## What type of PR is this? (check all applicable)

- [x] 🍕 Feature
- [x] 🐛 Bug Fix
- [x] 📝 Documentation Update
- [x] 🧑‍💻 Code Refactor
- [ ] 🔥 Performance Improvements
- [ ] ✅ Test
- [x] 🤖 Build
- [ ] ⏩ Revert

## Related Tickets & Documents
<!-- 
Please use this format link issue numbers: Fixes #123

https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword
-->



## Mobile & Desktop Screenshots/Recordings

<!-- Visual changes require screenshots -->



## Steps to QA
<!-- 
Please provide some steps for the reviewer to test your change. If you
have wrote tests, you can mention that here instead.

1. Click a link
4. Do this thing
5. Validate you see the thing working
-->



## Added to documentation?

- [x] 📜 README.md
- [ ] 📓 docs.example.com
- [ ] 🙅 no documentation needed
  • Loading branch information
samucodesh authored Oct 6, 2024
2 parents c179514 + 8a7d7a6 commit 77dbf07
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
47 changes: 45 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,45 @@
# Go-Docker-Test
Test Github Codespaces
## Go-Docker-Test

**Description:**

This project is a simple Go application that demonstrates how to build and run a Docker image. It's a great starting point for learning how to containerize Go applications.

**Prerequisites:**

* **Git:** To clone the repository and manage version control.
* **Docker:** To build and run the Docker image.

**Cloning the Repository:**

1. **Initialize a new local repository:**
```bash
git init
```
2. **Add a remote:**
```bash
git remote add origin git@github.com:samucodesh/Go-Docker-Test.git
```
3. **Clone the repository:**
```bash
git pull origin main
```

**Building the Image:**

Navigate to the root directory of the project and run the following command:

```bash
docker build -t mygoapp .
```

This will build the Docker image from the Dockerfile in the current directory and tag it as `mygoapp`.

**Running the Image:**

To run the image in a container, use the following command:

```bash
docker run -p 8080:8080 mygoapp
```

This will start a container from the `mygoapp` image and map port 8080 of the container to port 8080 of your local machine. You can access your application at `http://localhost:8080`.
8 changes: 6 additions & 2 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
FROM go:1.20.2
FROM golang:1.20.2

WORKDIR /app

COPY app/. .

RUN go build -o main main.go

EXPOSE 8080

CMD ["go", "run", "main.go"]
CMD ["./main"]

0 comments on commit 77dbf07

Please sign in to comment.