Skip to content

Commit

Permalink
fix docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
alldoami committed Jan 28, 2025
1 parent 210ed27 commit c74b494
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
FROM 533267185808.dkr.ecr.us-west-2.amazonaws.com/docker.io/central/library/golang:1.22-alpine AS builder
# Builder Stage
FROM docker.io/library/golang:1.22-alpine AS builder
WORKDIR /app

# Build argument for the image tag (if required)
ARG IMAGE_TAG

RUN apk update
RUN apk --update add --no-cache git tzdata
ADD . .
# Install dependencies for building the app
RUN apk add --no-cache git tzdata

# Copy source code into the container
COPY . .

# Build the Go binary
RUN GOPROXY=direct go build -o api .

FROM 533267185808.dkr.ecr.us-west-2.amazonaws.com/docker.io/central/library/alpine:3
# Final Stage
FROM docker.io/library/alpine:3
WORKDIR /app
RUN apk update && apk upgrade && apk --no-cache add curl

# Install runtime dependencies
RUN apk add --no-cache curl

# Copy the built binary from the builder stage
COPY --from=builder /app/api /app/

# Ensure the binary is executable
RUN chmod +x /app/api

# Expose port 3000 for the application
EXPOSE 3000
ENTRYPOINT ./api

# Entry point for the container
ENTRYPOINT ["/app/api"]

0 comments on commit c74b494

Please # to comment.