-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (33 loc) · 1.26 KB
/
Copy pathDockerfile
File metadata and controls
47 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Use an official Golang runtime as a parent image
FROM golang:1.23.4 AS builder
# Set the working directory inside the container
WORKDIR /app
# Install Git (required for pulling the repo)
RUN apt-get update && apt-get install -y git
ARG GITHUB_REPO_URL="https://residex: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@github.com/residex/SentireNotesBackendRecode.git"
# Clone the Github repository
RUN git clone ${GITHUB_REPO_URL} .
# Download and install any dependencies using Go Modules
RUN go mod download
# Verify dependencies
RUN go mod verify
# Build the Go application
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o main .
# Create a minimal image for running the application
FROM alpine:latest
# Copy the built executable from the builder stage
COPY --from=builder /app/main /app/main
RUN chmod +x /app/main
# Expose the port your application listens on (if applicable)
# Replace <YOUR_APP_PORT> with the actual port your Go app uses. Omit if not a web application.
# EXPOSE <YOUR_APP_PORT>
EXPOSE 8000
# Set the working directory
WORKDIR /app
ENV DATABASE_USER="database" \
DATABASE_PASSWORD="xinhl858C2333222" \
DATABASE_HOST="45.32.191.186" \
DATABASE_PORT="5432" \
DATABASE_NAME="database"
# Command to run when the container starts
CMD ["./main"]