This repository has been archived by the owner on Jul 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from xxxibgdrgnmm/refactor-repository
feat: refactor repository factory, add readme
- Loading branch information
Showing
20 changed files
with
136 additions
and
38 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.idea/ | ||
reverse-registry |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM cgr.dev/chainguard/go AS builder | ||
COPY . /app | ||
RUN cd /app && CGO_ENABLED=0 GOOS=linux go build -o reverse-registry . | ||
|
||
FROM cgr.dev/chainguard/glibc-dynamic | ||
COPY --from=builder /app/reverse-registry /usr/bin/ | ||
COPY ./config/config.local.yaml /etc/reverse-registry/config.local.yaml | ||
CMD ["/usr/bin/go-digester", "server", "--config=/etc/reverse-registry/config.local.yaml"] |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Reverse registry | ||
|
||
|
||
This is a simple registry redirect service that redirect our.domain.com/* to cgr.dev/chainguard/*. It also run a background process to periodically hash image index to sha256 checksum and save to a local database (default in-mem sqlite is used. For production purpose, mysql is the recommended choice) | ||
|
||
Deploying | ||
|
||
[![Run on Google Cloud](https://deploy.cloud.run/button.svg)](https://deploy.cloud.run) |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "reverse-registry", | ||
"env": { | ||
"WORKER_FETCH_INTERVAL": { | ||
"description": "specify interval to fetch manifest from cgr", | ||
"value": "30s", | ||
"required": true | ||
} | ||
}, | ||
"options": { | ||
"allow-unauthenticated": false, | ||
"memory": "512Mi", | ||
"cpu": "1", | ||
"port": 443, | ||
"http2": false, | ||
"concurrency": 80, | ||
"max-instances": 1 | ||
}, | ||
"build": { | ||
"skip": false, | ||
"buildpacks": { | ||
"builder": "gcr.io/buildpacks/builder:v1" | ||
} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
db: sqlite | ||
dbConfig: | ||
host: localhost | ||
user: root | ||
|
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package constant | ||
|
||
const ( | ||
WorkerFetchIntervalEnv = "WORKER_FETCH_INTERVAL" | ||
MySQLPassWordEnv = "MYSQL_PASSWORD" | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package driver | ||
|
||
import ( | ||
"github.com/xxxibgdrgnmm/reverse-registry/model" | ||
"gorm.io/driver/sqlite" | ||
"gorm.io/gorm" | ||
"gorm.io/gorm/logger" | ||
) | ||
|
||
func NewSqliteDB() (*gorm.DB, error) { | ||
db, err := gorm.Open(sqlite.Open("file::memory:?cache=shared"), &gorm.Config{ | ||
Logger: logger.Default.LogMode(logger.Silent), | ||
}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
db.AutoMigrate( | ||
&model.ImageModel{}, | ||
) | ||
return db, nil | ||
} |
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
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
File renamed without changes.
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
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