xtablo-source/go_backend/Dockerfile
Arthur Belleville 50ba9b340b
Modify backend
2025-03-15 08:46:51 +01:00

30 lines
No EOL
601 B
Docker

FROM golang:alpine
# Set necessary environmet variables needed for our image
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
# Move to working directory /build
WORKDIR /build
# Copy the code from /app to the build folder into the container
COPY . .
# Configure the build (go.mod and go.sum are already copied with prior step)
RUN go mod download
# Build the application
RUN go build -o main .
WORKDIR /app
# Copy binary from build to main folder
RUN cp /build/main .
# Export necessary port
EXPOSE 8080
# Command to run when starting the container
CMD ["/app/main"]