make this will make it smaller, idk
All checks were successful
Deploy App / docker (ubuntu-latest, 2.44.0) (push) Successful in 43s
Publish Docker Image / docker (ubuntu-latest, 2.44.0) (push) Successful in 33s

This commit is contained in:
Lee
2024-06-10 22:44:15 +01:00
parent a43930c545
commit 75e4f7ae38

View File

@ -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"]