From 25c655bee36b19aaab429b3bba5fe0041611e4a2 Mon Sep 17 00:00:00 2001 From: dije07 <71131378+dije07@users.noreply.github.com> Date: Wed, 3 Apr 2024 00:00:27 +0700 Subject: [PATCH] Add files via upload --- quantification/Dockerfile | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 quantification/Dockerfile diff --git a/quantification/Dockerfile b/quantification/Dockerfile new file mode 100644 index 0000000..c5a1256 --- /dev/null +++ b/quantification/Dockerfile @@ -0,0 +1,42 @@ +# Start with the Go alpine image +FROM golang:alpine AS builder + +ENV REDIS_ADDR="localhost:6379" +ENV DB_HOST="localhost" +ENV DB_PORT=5432 +ENV DB_USER="postgres" \ + DB_PASSWORD="postgres" \ + DB_NAME="sleep_monitoring" \ + GO111MODULE=on \ + CGO_ENABLED=0 \ + GOOS=linux + +# Set the Current Working Directory inside the container +WORKDIR /app + +# Copy go mod and sum files +# COPY go.mod go.sum ./ + +COPY . . +# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed +RUN go mod download + +# Copy the source code from the current directory to the Working Directory inside the container + +# Build the Go app +RUN go build -o main . + +# Start a new stage from scratch +FROM alpine:latest + +# Set the Current Working Directory inside the container +WORKDIR /root/ + +# Copy the Pre-built binary file from the previous stage +COPY --from=builder /app/main . + +# Expose port 9001 to the outside world +EXPOSE 9001 + +# Command to run the executable +CMD ["./main"]