-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
69 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,41 @@ | ||
# Go image as the base image | ||
# Mini golang base image | ||
FROM golang:1.20-alpine as builder | ||
|
||
# Set working directory | ||
RUN apk add --no-cache build-base | ||
|
||
|
||
# Create work dir | ||
WORKDIR /app | ||
|
||
# Copy application code into the working directory | ||
# Copy go module files and download dependecy | ||
COPY go.mod ./ | ||
|
||
COPY go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
# Copy the entire application to directory | ||
COPY . . | ||
|
||
# Builid the application | ||
RUN go build -o main | ||
RUN CGO_ENABLED=1 GOOS=linux go build -o /app -a -ldflags '-linkmode external -extldflags "-static"' . | ||
|
||
# Build the application | ||
RUN go build -o main . | ||
|
||
# Image for fina stage | ||
FROM alpine:latest | ||
|
||
# create work dir | ||
WORKDIR /app | ||
|
||
# Copy built app to work directory | ||
COPY --from=builder /app/main . | ||
|
||
# Copy env file | ||
COPY .env .env | ||
|
||
# Expose application port | ||
EXPOSE ${PORT} | ||
# Expose port | ||
EXPOSE 9090 | ||
|
||
# Run executable | ||
CMD [ "./main" ] | ||
# Run the executable | ||
CMD ["./main"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module github.com/dkrest1/task-manager | ||
|
||
go 1.21.5 | ||
go 1.21 | ||
|
||
require ( | ||
github.com/golang-jwt/jwt/v5 v5.2.0 | ||
|