Skip to content

Commit

Permalink
fix:go.sum not found
Browse files Browse the repository at this point in the history
  • Loading branch information
piyush7833 committed Jun 27, 2024
1 parent aad4575 commit 7c816c8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
1 change: 0 additions & 1 deletion .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ jobs:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
DB_URI: ${{ secrets.DB_URI }}
run: |
cd docker
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
docker build --build-arg JWT_SECRET=${JWT_SECRET} --build-arg DB_URI=${DB_URI} -t piyush7833/chat-api:latest .
docker push piyush7833/chat-api:latest
Expand Down
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Build stage
FROM golang:1.22.2 AS builder
WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN go build -o main .

# Final stage
FROM ubuntu AS final

WORKDIR /app

COPY --from=builder /app .

# Expose port 8080
EXPOSE 8080

# Set environment variables

ARG JWT_SECRET
ARG DB_URI
ENV JWT_SECRET=${JWT_SECRET}
ENV DB_URI=${DB_URI}
ENV ENVIRONMENT="production"


CMD ["./main"]

0 comments on commit 7c816c8

Please sign in to comment.