portfolio/Dockerfile

30 lines
614 B
Docker
Raw Permalink Normal View History

2024-02-13 18:45:08 +01:00
# Use an official Golang runtime as a parent image
2024-05-16 20:43:34 +02:00
FROM golang:latest as build
2024-02-13 18:45:08 +01:00
# Set the working directory to /app
WORKDIR .
# Copy the current directory contents into the container at /app
2024-05-15 15:49:39 +02:00
COPY . .
2024-02-13 18:45:08 +01:00
# Download and install any required dependencies
RUN go mod download
2024-05-16 20:43:34 +02:00
# Generate orm
RUN go generate ./database/ent
2024-02-13 18:45:08 +01:00
# Build the Go app
2024-02-13 18:57:05 +01:00
RUN go build .
2024-02-13 18:45:08 +01:00
2024-05-16 20:43:34 +02:00
FROM gcr.io/distroless/base-debian12
COPY --from=build /go/portfolio .
ADD .env .
2024-05-18 12:10:29 +02:00
ADD ./web/assets ./web/assets
2024-02-14 12:39:10 +01:00
2024-02-13 18:45:08 +01:00
# Expose port 8080 for incoming traffic
2024-05-16 18:55:03 +02:00
EXPOSE 4000
2024-05-16 18:42:31 +02:00
EXPOSE 4001
2024-02-13 18:45:08 +01:00
# Define the command to run the app when the container starts
2024-05-16 17:36:44 +02:00
CMD ["./portfolio"]