Skip to content

Commit 36ff3c2

Browse files
committed
build: docker release
1 parent e1d34c5 commit 36ff3c2

File tree

16 files changed

+1157
-1404
lines changed

16 files changed

+1157
-1404
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.github
2+
.git
3+
.husky
4+
.vscode
5+
build
6+
node_modules
7+
*.log
8+
.env

.github/release-docker.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
name: Release and deploy
1+
name: Release
22
on:
33
push:
44
branches:
55
- main # change to main if needed
66
- next
7+
- static
8+
79
jobs:
810
release:
911
runs-on: ubuntu-latest
@@ -30,10 +32,17 @@ jobs:
3032
yarn lint:ci
3133
yarn prettier:ci
3234
33-
- uses: superfly/flyctl-actions/setup-flyctl@master
34-
if: ${{ github.ref_name == 'main' }}
35+
- name: Login to GitHub Container Registry
36+
uses: docker/login-action@v3
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.actor }}
40+
password: ${{ github.token }}
3541

36-
- run: flyctl deploy --strategy bluegreen --remote-only --env SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} --env LIDO_AUTH_TOKEN=${{ secrets.LIDO_AUTH_TOKEN }} --env RESOLV_AUTH_TOKEN=${{ secrets.RESOLV_AUTH_TOKEN }} --build-target app --dockerfile docker/Dockerfile.flyio --ha=false
37-
if: ${{ github.ref_name == 'main' }}
42+
- name: Semantic Release
43+
uses: cycjimmy/semantic-release-action@v4
44+
with:
45+
extra_plugins: |
46+
@codedependant/semantic-release-docker
3847
env:
39-
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
48+
GITHUB_TOKEN: ${{ github.token }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
22
1+
24

.releaserc.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
{
22
"branches": [
3-
{
4-
"name": "main"
5-
}
3+
{ "name": "main" },
4+
{ "name": "next", "channel": "next", "prerelease": "next" },
5+
{ "name": "static", "channel": "static", "prerelease": "static" },
6+
{ "name": "+([0-9])?(.{+([0-9]),x}).x" }
67
],
78
"plugins": [
89
"@semantic-release/commit-analyzer",
910
"@semantic-release/release-notes-generator",
1011
[
1112
"@semantic-release/github",
12-
{
13-
"successComment": false,
14-
"failTitle": false
15-
}
13+
{ "successComment": false, "failTitle": false }
1614
],
1715
[
1816
"@codedependant/semantic-release-docker",
@@ -21,9 +19,7 @@
2119
"{{#if prerelease.[0]}}{{prerelease.[0]}}{{else}}latest{{/if}}",
2220
"{{version}}"
2321
],
24-
"dockerArgs": {
25-
"PACKAGE_VERSION": "{{version}}"
26-
},
22+
"dockerArgs": { "PACKAGE_VERSION": "{{version}}" },
2723
"dockerImage": "apy-server",
2824
"dockerRegistry": "ghcr.io",
2925
"dockerProject": "gearbox-protocol",

Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM node:24.11 AS dev
2+
3+
ENV YARN_CACHE_FOLDER=/root/.yarn
4+
5+
ARG SENTRY_AUTH_TOKEN
6+
ARG SENTRY_ORG
7+
ARG SENTRY_PROJECT
8+
9+
ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN}
10+
ENV SENTRY_ORG=${SENTRY_ORG}
11+
ENV SENTRY_PROJECT=${SENTRY_PROJECT}
12+
13+
WORKDIR /app
14+
15+
COPY . .
16+
17+
RUN --mount=type=cache,id=yarn,target=/root/.yarn \
18+
corepack enable \
19+
&& yarn install --immutable \
20+
&& yarn build
21+
22+
# Production npm modules
23+
24+
FROM node:24.11 AS prod
25+
26+
ENV YARN_CACHE_FOLDER=/root/.yarn
27+
28+
WORKDIR /app
29+
30+
COPY --from=dev /app/package.json /app/yarn.lock /app/.yarnrc.yml /app/
31+
COPY --from=dev /app/build/ /app/build
32+
33+
RUN --mount=type=cache,id=yarn,target=/root/.yarn \
34+
corepack enable \
35+
&& yarn workspaces focus --all --production
36+
37+
# Final image
38+
39+
FROM gcr.io/distroless/nodejs24-debian12
40+
ARG PACKAGE_VERSION
41+
ENV PACKAGE_VERSION=${PACKAGE_VERSION:-dev}
42+
LABEL org.opencontainers.image.version="${PACKAGE_VERSION}"
43+
44+
WORKDIR /app
45+
COPY --from=prod /app /app
46+
CMD ["--enable-source-maps", "/app/build/index.mjs"]

build.mjs

Lines changed: 0 additions & 13 deletions
This file was deleted.

docker/Dockerfile.flyio

Lines changed: 0 additions & 26 deletions
This file was deleted.

esbuild.config.mjs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,35 @@
1+
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";
12
import { build } from "esbuild";
23

4+
const { SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT } = process.env;
5+
36
build({
4-
entryPoints: ["main.ts"],
7+
entryPoints: ["src/index.ts"],
58
outdir: "build",
69
bundle: true,
710
platform: "node",
811
format: "esm",
912
outExtension: { ".js": ".mjs" },
10-
target: ["node20"],
13+
target: ["node24"],
1114
sourcemap: "external",
1215
banner: {
1316
js: `
1417
import { createRequire } from 'module';
1518
import { fileURLToPath } from 'url';
1619
1720
const require = createRequire(import.meta.url);
18-
const __filename = fileURLToPath(import.meta.url);
19-
const __dirname = path.dirname(__filename);
2021
`,
2122
},
22-
external: ["node-pty"],
23+
plugins:
24+
SENTRY_AUTH_TOKEN && SENTRY_ORG
25+
? [
26+
sentryEsbuildPlugin({
27+
authToken: SENTRY_AUTH_TOKEN,
28+
org: SENTRY_ORG,
29+
project: SENTRY_PROJECT || "apy-server",
30+
}),
31+
]
32+
: undefined,
2333
}).catch(e => {
2434
console.error(e);
2535
process.exit(1);

fly.toml

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)