make this will make it smaller, idk
This commit is contained in:
24
Dockerfile
24
Dockerfile
@ -1,18 +1,28 @@
|
||||
# Use the official Golang image as the base image
|
||||
FROM golang:latest AS builder
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the source code to the container
|
||||
COPY . .
|
||||
|
||||
# Build the Go application
|
||||
RUN make
|
||||
|
||||
# Stage 2: Create the final image with a smaller base image
|
||||
FROM golang:latest
|
||||
|
||||
# Set the working directory inside the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the Makefile and source code to the container
|
||||
COPY Makefile .
|
||||
COPY . .
|
||||
|
||||
# Build the Go application using the Makefile
|
||||
RUN make build
|
||||
# Copy the necessary files from the builder stage to the final image
|
||||
COPY --from=builder /app/bin/paste /app/bin/paste
|
||||
COPY --from=builder /app/public /app/public
|
||||
|
||||
# Expose the port that the application listens on
|
||||
EXPOSE 8080
|
||||
ENV PORT=8080
|
||||
|
||||
# Run the Go application
|
||||
CMD ["./bin/paste"]
|
||||
CMD ["./bin/paste"]
|
||||
|
Reference in New Issue
Block a user