Skip to content

Commit deb89b6

Browse files
Initial commit
0 parents  commit deb89b6

17 files changed

+797
-0
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
config/
2+
dist/
3+
node_modules/

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily

.github/workflows/ci.yml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
on: push
3+
4+
permissions:
5+
contents: read
6+
id-token: write
7+
8+
jobs:
9+
build:
10+
name: Build
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- uses: actions/checkout@v3
14+
- uses: pnpm/[email protected]
15+
with:
16+
version: 7.x.x
17+
- uses: actions/setup-node@v3
18+
with:
19+
node-version: '16'
20+
cache: pnpm
21+
- run: pnpm install --frozen-lockfile
22+
- run: pnpm lint
23+
- run: pnpm type-check
24+
- run: pnpm build
25+
26+
package:
27+
name: Package
28+
runs-on: ubuntu-20.04
29+
steps:
30+
- uses: actions/checkout@v3
31+
- uses: depot/setup-action@v1
32+
- uses: docker/metadata-action@v4
33+
id: meta
34+
with:
35+
images: ghcr.io/depot/cloud-agent
36+
github-token: ${{ secrets.GITHUB_TOKEN }}
37+
tags: |
38+
type=ref,event=branch
39+
type=ref,event=pr
40+
type=semver,pattern={{version}}
41+
type=semver,pattern={{major}}.{{minor}}
42+
type=semver,pattern={{major}}
43+
- uses: docker/login-action@v2
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
- uses: depot/build-push-action@v1
49+
with:
50+
platforms: linux/amd64,linux/arm64
51+
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
52+
tags: ${{ steps.meta.outputs.tags }}
53+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
config/
2+
dist/
3+
node_modules/
4+
*.log
5+
.env*

.node-dev.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"extensions": {
3+
"ts": "esbuild-register"
4+
}
5+
}

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/
2+
pnpm-lock.yaml

.prettierrc.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
printWidth: 120,
3+
semi: false,
4+
singleQuote: true,
5+
trailingComma: 'all',
6+
bracketSpacing: false,
7+
plugins: [require('prettier-plugin-organize-imports'), require('prettier-plugin-pkg')],
8+
}

.vscode/settings.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"prettier.prettierPath": "node_modules/prettier/index.js",
3+
"typescript.tsdk": "node_modules/typescript/lib",
4+
"typescript.enablePromptUseWorkspaceTsdk": true
5+
}

Dockerfile

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM node:16-alpine AS build
2+
3+
RUN corepack enable
4+
WORKDIR /app
5+
COPY package.json pnpm-lock.yaml ./
6+
RUN pnpm install --frozen-lockfile
7+
COPY . .
8+
RUN pnpm build
9+
10+
FROM node:16-alpine AS dependencies
11+
12+
RUN corepack enable
13+
WORKDIR /app
14+
COPY package.json pnpm-lock.yaml ./
15+
RUN pnpm install --frozen-lockfile --production
16+
17+
FROM node:16-alpine
18+
19+
WORKDIR /app
20+
COPY --from=dependencies /app/node_modules /app/node_modules
21+
COPY --from=build /app/dist /app/dist
22+
23+
CMD [ "node", "dist/index.js" ]

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# cloud-agent [![CI](https://github.com/depot/cloud-agent/workflows/CI/badge.svg)](https://github.com/depot/cloud-agent/actions)
2+
3+
Agent process that manages cloud infrastructure for self-hosted Depot connections.

build.cjs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const esbuild = require('esbuild')
2+
const {nodeExternalsPlugin} = require('esbuild-node-externals')
3+
4+
esbuild.build({
5+
entryPoints: ['src/index.ts'],
6+
bundle: true,
7+
platform: 'node',
8+
target: 'node16',
9+
outfile: 'dist/index.js',
10+
sourcemap: true,
11+
plugins: [nodeExternalsPlugin({allowList: ['node-fetch']})],
12+
})

depot.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"id": "1ppdzf1919"}

package.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"private": true,
3+
"main": "./dist/index.js",
4+
"scripts": {
5+
"build": "node ./build.cjs",
6+
"dev": "node-dev --no-notify src/index.ts",
7+
"format": "prettier --write .",
8+
"lint": "prettier --check .",
9+
"logs": "flyctl logs",
10+
"type-check": "tsc --noEmit"
11+
},
12+
"dependencies": {
13+
"@sentry/node": "^6.19.7",
14+
"dotenv": "^16.0.1",
15+
"undici": "^5.3.0"
16+
},
17+
"devDependencies": {
18+
"@types/node": "16.x",
19+
"esbuild": "^0.14.39",
20+
"esbuild-node-externals": "^1.4.1",
21+
"esbuild-register": "^3.3.2",
22+
"node-dev": "^7.4.3",
23+
"prettier": "^2.6.2",
24+
"prettier-plugin-organize-imports": "^2.3.4",
25+
"prettier-plugin-pkg": "^0.13.2",
26+
"typescript": "^4.6.4"
27+
},
28+
"packageManager": "[email protected]"
29+
}

0 commit comments

Comments
 (0)