From e6bf47a76949fd9dbaee5d9d23f33e0bbc1cfeab Mon Sep 17 00:00:00 2001 From: "n.nakhostin" Date: Sun, 31 Aug 2025 17:13:57 +0330 Subject: [PATCH] Refactor Dockerfile and Update CI Configuration - Changed the working directory in the Dockerfile to /app for better organization. - Removed the iat.yaml configuration file to simplify the container setup and reduce complexity. - Adjusted the exposed port to 80, aligning with standard HTTP practices for the scraper application. - Updated the CI configuration in .drone.yml to reflect these changes, ensuring a streamlined build process. --- .drone.yml | 1 - cmd/scraper/Dockerfile | 13 ++++++------- cmd/scraper/iat.yaml | 28 ---------------------------- 3 files changed, 6 insertions(+), 36 deletions(-) delete mode 100644 cmd/scraper/iat.yaml diff --git a/.drone.yml b/.drone.yml index 4705d47..4704dae 100644 --- a/.drone.yml +++ b/.drone.yml @@ -18,7 +18,6 @@ steps: - APP_VERSION=$(git rev-list HEAD --count --no-merges)-$DRONE_BRANCH - echo "APP Version tags $APP_VERSION" - echo -n "$APP_VERSION" >> .tags - - name: build web image: plugins/docker settings: diff --git a/cmd/scraper/Dockerfile b/cmd/scraper/Dockerfile index 7ee36c0..87297cd 100644 --- a/cmd/scraper/Dockerfile +++ b/cmd/scraper/Dockerfile @@ -3,21 +3,20 @@ ARG BASH_VERSION=5.0 FROM golang:${GO_VERSION} AS go-builder -WORKDIR /go/src/company/tm_back +WORKDIR /app COPY . . -COPY cmd/scraper/iat.yaml /go/bin/config.yaml RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -v -o scraper-build ./cmd/scraper/main.go FROM bash:${BASH_VERSION} RUN apk --no-cache add busybox-suid curl rsync tzdata tcpdump tree ca-certificates s-nail \ - && ln -s /usr/bin/mail /usr/bin/s-nail \ - && mkdir -p /go/bin/media /go/bin/log /go/bin/config -WORKDIR /go/bin + && ln -s /usr/bin/mail /usr/bin/s-nail -COPY --from=go-builder /go/src/company/tm_back/scraper-build . +WORKDIR /app -EXPOSE 8090 +COPY --from=go-builder /app/scraper-build . + +EXPOSE 80 ENTRYPOINT /go/bin/scraper-build diff --git a/cmd/scraper/iat.yaml b/cmd/scraper/iat.yaml deleted file mode 100644 index a78879d..0000000 --- a/cmd/scraper/iat.yaml +++ /dev/null @@ -1,28 +0,0 @@ -database: - mongodb: - uri: "mongodb://mongo:27017" - name: "tender_management" - timeout: 10s - max_pool_size: 50 - -logging: - level: "info" - format: "json" - output: "file" # stdout, stderr, file - file: - path: "./logs/scraper.log" - max_size: 100 # Max size in MB before rotation - max_backups: 5 # Number of backup files to keep - max_age: 30 # Max age in days to keep log files - compress: true # Compress rotated files - -ted: - base_url: "https://ted.europa.eu/packages/daily" - timeout: 300s # Increased to 5 minutes for large files - max_retries: 5 - retry_delay: 10s - user_agent: "TenderManagement-TED-Scraper/1.0" - max_concurrency: 2 # Reduced to avoid overwhelming the server - download_dir: "./ted_downloads" - cleanup_after: 72h - scraping_interval: 12h # Run scraping every 12 hours