forked from chainbound/valtrack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
64,039 additions
and
12,006 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ peerstore.db | |
*.parquet | ||
*.sqlite | ||
*.sqlite-journal | ||
**/._* | ||
api_keys.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,42 @@ | ||
ARG GO_VERSION=1.22.5 | ||
FROM golang:${GO_VERSION}-bookworm as builder | ||
|
||
# Install CA certificates | ||
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* | ||
# Stage 1: Dependency management and build | ||
FROM golang:${GO_VERSION}-bookworm as builder | ||
|
||
# Set the working directory inside the container to /usr/src/app | ||
WORKDIR /usr/src/app | ||
WORKDIR /app | ||
|
||
# Copy the Go module files first to leverage Docker cache for dependency layers | ||
# Copy go.mod and go.sum files | ||
COPY go.mod go.sum ./ | ||
|
||
# Run module download separately to also leverage caching of downloaded modules | ||
# Download dependencies and verify modules | ||
RUN go mod download && go mod verify | ||
|
||
# Copy the CSV file into a data directory within the builder stage | ||
COPY ip_metadata.csv ./data/ip_metadata.csv | ||
|
||
# Copy the rest of the application source code | ||
COPY . . | ||
|
||
# Build the application; output the binary to a known location | ||
RUN go build -v -o /run-app . | ||
# Run go mod tidy to ensure the go.mod file is up to date | ||
RUN go mod tidy | ||
|
||
# Expose port 9000 if it's being used by the application | ||
EXPOSE 9000 | ||
# Build the application and capture the output | ||
RUN go build -v -o /run-app . | ||
|
||
# Final stage based on Debian Bookworm. | ||
FROM debian:bookworm | ||
# Stage 2: Final stage | ||
FROM debian:bookworm-slim | ||
|
||
# Install CA certificates in the final image to ensure they are present. | ||
# Install CA certificates in the final image | ||
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the built executable from the builder stage | ||
COPY --from=builder /run-app /usr/local/bin/run-app | ||
|
||
# Copy the CSV and other data files from the builder stage to the runtime image | ||
COPY --from=builder /usr/src/app/data /data | ||
# Create necessary directory | ||
RUN mkdir -p /app/data | ||
|
||
# Copy the CSV file to /app/data | ||
COPY /data/ip_metadata.csv /app/data/ip_metadata.csv | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Set the command to run the application | ||
CMD ["/usr/local/bin/run-app"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.