Skip to content

Commit

Permalink
fix: 🐛 dockerignore handling
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Ruck <[email protected]>
  • Loading branch information
Manuel Ruck committed Aug 17, 2024
1 parent 434a761 commit 465194f
Show file tree
Hide file tree
Showing 29 changed files with 98 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: infra/Dockerfile.service
file: infra/service.Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.actor != 'dependabot[bot]' }}
target: runner
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ docker buildx build \
--build-arg SERVICE=$SERVICE \
--build-arg SERVICE_PATH=$SERVICE_PATH \
--build-arg NODE_VERSION=$(cat .node-version | tr -d 'v') \
-f infra/Dockerfile.service \
-f infra/service.Dockerfile \
-t $SERVICE \
.
```
Expand Down
4 changes: 2 additions & 2 deletions bundestag.io/admin/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
targetStage:
$if: ${this.mode == "sync"}
$then: dev
Expand Down
4 changes: 2 additions & 2 deletions bundestag.io/api/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
targetStage:
$if: ${this.mode == "sync"}
$then: dev
Expand Down
46 changes: 46 additions & 0 deletions countDependencies.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
const fs = require('fs');
const path = require('path');

const ignoreDirs = ['node_modules', '.git', '.garden'];

const searchDirectory = (dir, fileList = []) => {
const files = fs.readdirSync(dir);
files.forEach((file) => {
if (ignoreDirs.includes(file)) {
return;
}
const filePath = path.join(dir, file);
if (fs.statSync(filePath).isDirectory()) {
searchDirectory(filePath, fileList);
} else if (file === 'package.json') {
fileList.push(filePath);
}
});
return fileList;
};

const countDependencies = (fileList) => {
const dependencyCount = {};
fileList.forEach((file) => {
const packageJson = JSON.parse(fs.readFileSync(file, 'utf8'));
const dependencies = { ...packageJson.dependencies, ...packageJson.devDependencies };
for (const dep in dependencies) {
if (dependencyCount[dep]) {
dependencyCount[dep]++;
} else {
dependencyCount[dep] = 1;
}
}
});
return dependencyCount;
};

const dir = '.'; // Start directory
const packageJsonFiles = searchDirectory(dir);
const dependencies = countDependencies(packageJsonFiles);

const sortedDependencies = Object.entries(dependencies).sort((a, b) => b[1] - a[1]);
console.log('Most used dependencies:');
sortedDependencies.forEach(([dep, count]) => {
console.log(`${dep}: ${count}`);
});
4 changes: 2 additions & 2 deletions democracy/desktop/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ source:
path: ../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
targetStage:
$if: ${this.mode == "sync"}
$then: dev
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
- democracy
bundestag-io:
build:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
target: dev
args:
- NODE_VERSION=18.18.2
Expand All @@ -32,7 +32,7 @@ services:
- democracy
bio-admin:
build:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
target: dev
args:
- NODE_VERSION=18.18.2
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
env*
.git
node_modules
logs
.env
.env.*
.next
*.log
.turbo
manifests
.garden
.garden
manifests
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"author": "Manuel Ruck <[email protected]>",
"license": "Apache-2.0",
"private": true,
"packageManager": "[email protected].0",
"packageManager": "[email protected].1",
"scripts": {
"build": "turbo run build",
"lint": "turbo run lint",
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/cleanup-push-queue/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: cleanup-push-queue
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/crawler/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: crawler
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/import-conference-week-details/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: import-conference-week-details
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/import-deputy-profiles/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: import-deputy-profiles
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/import-named-poll-deputies/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: import-named-poll-deputies
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/import-named-polls/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: import-named-polls
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/import-plenary-minutes/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: import-plenary-minutes
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/index-sync-bundestagio/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: index-sync-bundestagio
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/index-sync-democracy/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: index-sync-democracy
Expand Down
5 changes: 2 additions & 3 deletions services/cron-jobs/push-send-queued/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: push-send-queued
Expand Down Expand Up @@ -51,4 +51,3 @@ spec:
SERVICE_ACCOUNT_CLIENT_EMAIL: ${base64Encode(var.SERVICE_ACCOUNT_CLIENT_EMAIL)}
SERVICE_ACCOUNT_PRIVATE_KEY: ${base64Encode(var.SERVICE_ACCOUNT_PRIVATE_KEY)}
SERVICE_ACCOUNT_PROJECT_ID: ${base64Encode(var.SERVICE_ACCOUNT_PROJECT_ID)}

4 changes: 2 additions & 2 deletions services/cron-jobs/queue-pushs-conference-week/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: queue-pushs-conference-week
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: queue-pushs-vote-conference-week
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/queue-pushs-vote-top-100/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: queue-pushs-vote-top-100
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/shedule-bio-resync/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: shedule-bio-resync
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/sync-deputy-profiles/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: sync-deputy-profiles
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/sync-named-polls/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: sync-named-polls
Expand Down
4 changes: 2 additions & 2 deletions services/cron-jobs/sync-procedures/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ source:
path: ../../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: sync-procedures
Expand Down
4 changes: 2 additions & 2 deletions services/non-named-votes-ai/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ source:
path: ../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: non-named-votes-ai
Expand Down
4 changes: 2 additions & 2 deletions services/qr-code-handler/garden.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ source:
path: ../../
include:
- ./**/*
- ./infra/Dockerfile.service
- ./infra/service.Dockerfile
spec:
dockerfile: ./infra/Dockerfile.service
dockerfile: ./infra/service.Dockerfile
buildArgs:
NODE_VERSION: 18.18.2
SERVICE: qr-code-handler
Expand Down

0 comments on commit 465194f

Please sign in to comment.