[PR #119] feat: docker build #422

Open
opened 2026-03-13 14:53:03 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/abh/geodns/pull/119
Author: @liuzheng
Created: 7/27/2020
Status: 🔄 Open

Base: mainHead: main


📝 Commits (1)

📊 Changes

3 files changed (+27 additions, -29 deletions)

View changed files

.dockerignore (+4 -0)
📝 Dockerfile (+20 -29)
📝 Makefile (+3 -0)

📄 Description

Docker image build with multi-stage and save build time.
Some code in Dockerfile is useless, such as

Dockerfile:
-ADD applog/ applog/
-ADD countries/ countries/
-ADD geodns-logs/ geodns-logs/
-ADD health/ health/
-ADD monitor/ monitor/
-ADD querylog/ querylog/
-ADD server/ server/
-ADD targeting/ targeting/
-ADD typeutil/ typeutil/
-ADD zones/ zones/
-ADD service/ service/
-ADD service-logs/ service-logs/
-ADD *.go build ./

+COPY . /goapp

There is no need to add code one by one. Use .dockerignore then one COPY .

Dockerfile:
+FROM golang as prepare
+COPY go.mod go.sum /goapp/
+WORKDIR /goapp/
+RUN go mod download

-ADD vendor/ vendor/

.dockerignore:
+.git/
+.idea/
+vendor/
+dist/

This change because vendor/ not always same in any OS system. Use stage prepare to download packages can save time.

Build Docker image

make docker-build

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/abh/geodns/pull/119 **Author:** [@liuzheng](https://github.com/liuzheng) **Created:** 7/27/2020 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`c70b92b`](https://github.com/abh/geodns/commit/c70b92be7ec51e6534cb9856317d2754cf4d239d) feat: docker build ### 📊 Changes **3 files changed** (+27 additions, -29 deletions) <details> <summary>View changed files</summary> ➕ `.dockerignore` (+4 -0) 📝 `Dockerfile` (+20 -29) 📝 `Makefile` (+3 -0) </details> ### 📄 Description Docker image build with multi-stage and save build time. Some code in `Dockerfile` is useless, such as ```diff Dockerfile: -ADD applog/ applog/ -ADD countries/ countries/ -ADD geodns-logs/ geodns-logs/ -ADD health/ health/ -ADD monitor/ monitor/ -ADD querylog/ querylog/ -ADD server/ server/ -ADD targeting/ targeting/ -ADD typeutil/ typeutil/ -ADD zones/ zones/ -ADD service/ service/ -ADD service-logs/ service-logs/ -ADD *.go build ./ +COPY . /goapp ``` There is no need to add code one by one. Use `.dockerignore` then one *COPY* . ```diff Dockerfile: +FROM golang as prepare +COPY go.mod go.sum /goapp/ +WORKDIR /goapp/ +RUN go mod download -ADD vendor/ vendor/ .dockerignore: +.git/ +.idea/ +vendor/ +dist/ ``` This change because `vendor/` not always same in any OS system. Use stage `prepare` to download packages can save time. ## Build Docker image make docker-build --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/geodns#422
No description provided.