Skip to content

Commit

Permalink
Merge pull request #4 from Yinebeb-01/fix-build
Browse files Browse the repository at this point in the history
docker build fixed
  • Loading branch information
yinebebt authored Mar 9, 2024
2 parents 93e0b89 + e88ba1b commit 2c58eb8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test.db
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
services/test.db
.idea/*
/godog_dependency_file_test.go
/simpleapi.log
/hexagonal_arch.log
/app.log
16 changes: 2 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,23 @@
# Start from the latest golang base image
FROM golang:latest

# Add Maintainer Info
LABEL maintainer="Yinebeb <[email protected]>"

# Set the Current Working Directory inside the container
WORKDIR /app

# Copy Go Modules dependency requirements file
COPY go.mod .

# Copy Go Modules expected hashes file
COPY go.sum .

# Download dependencies
RUN go mod download

# Copy all the app sources (recursively copies files and directories from the host into the image)
COPY . .

# Set rest port
ENV PORT 5000

# Build the app
RUN go build
RUN go build -o app cmd/main.go

# Remove source files
RUN find . -name "*.go" -type f -delete

# Make port 5000 available to the world outside this container
EXPOSE $PORT

# Run the app
CMD ["./hexagonal_arch"]
CMD ["./app"]
6 changes: 3 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ var (

// @title hexagonal-architecture
// @version 0.1.0
// @contact.name yinebe-tariku
// @contact.url https://www.linkedin.com/yinebeb-tariku
// @contact.name Yinebe T.
// @contact.url www.linkedin.com/in/yinebeb-tariku
// @contact.email [email protected]
// @host localhost
// @BasePath /v1
Expand Down Expand Up @@ -63,7 +63,7 @@ func main() {

// configOutput create a custom logger file to see debugging outputs.
func configOutput() {
writer, err := os.Create("hexagonalarch.log")
writer, err := os.Create("app.log")
if err != nil {
log.Println("unable to create log file")
}
Expand Down

0 comments on commit 2c58eb8

Please sign in to comment.