Skip to content

Commit

Permalink
feat: update the Dockerfile to use Go 1.22
Browse files Browse the repository at this point in the history
  • Loading branch information
rowjay007 committed Jan 23, 2025
1 parent 90edc63 commit 7407343
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 17 deletions.
23 changes: 7 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

# Build stage
FROM golang:1.21-alpine AS builder
FROM golang:1.22-alpine AS builder

WORKDIR /app

# Install build dependencies
RUN apk add --no-cache git make
RUN apk add --no-cache gcc musl-dev

# Copy go mod files
COPY go.mod go.sum ./
Expand All @@ -15,27 +15,18 @@ RUN go mod download
COPY . .

# Build the application
RUN make build
RUN CGO_ENABLED=0 GOOS=linux go build -o main ./cmd/server/main.go

# Final stage
FROM alpine:3.18
FROM alpine:latest

WORKDIR /app

# Add necessary runtime dependencies
RUN apk add --no-cache ca-certificates tzdata

# Copy binary and config
COPY --from=builder /app/bin/walkit .
COPY --from=builder /app/config ./config

# Set environment variables
ENV GIN_MODE=release
ENV APP_ENV=production
ENV POCKET_BASE_URL=http://pocketbase:8090/api
# Copy the binary from builder
COPY --from=builder /app/main .

# Expose port
EXPOSE 8080

# Run the application
CMD ["./walkit"]
CMD ["./main"]
1 change: 0 additions & 1 deletion tmp/air.log

This file was deleted.

Binary file added tmp/main
Binary file not shown.

0 comments on commit 7407343

Please sign in to comment.