Skip to content

Commit

Permalink
Improve Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
robertjndw committed Sep 19, 2023
1 parent 20b05b4 commit fd4be90
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Use an official Go runtime as a parent image
FROM golang:1.21 AS builder
FROM golang:1.21-alpine AS builder

# Set the working directory inside the container
WORKDIR /app
Expand All @@ -8,19 +8,21 @@ WORKDIR /app
COPY . .

# Build the Go application
RUN go build -o test .
RUN go build -o bitbucket-archiver .

# Start a new stage for the minimal runtime container
FROM ubuntu
FROM alpine:latest

RUN apk update && apk add ca-certificates libc6-compat

# Set the working directory inside the minimal runtime container
WORKDIR /app

# Copy the built binary from the builder container into the minimal runtime container
COPY --from=builder /app/test .
COPY --from=builder /app/bitbucket-archiver .

# Expose the port your Go application listens on (if applicable)
# EXPOSE 8080
# Ensure the binary is executable
RUN chmod +x /app/bitbucket-archiver

# Run your Go application
CMD ["./test"]
CMD ["/app/bitbucket-archiver"]

0 comments on commit fd4be90

Please sign in to comment.