Skip to content

Commit cb72cef

Browse files
committed
Publish OCI containers to GitHub registry
1 parent f27c96e commit cb72cef

File tree

9 files changed

+129
-90
lines changed

9 files changed

+129
-90
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.env
2-
Dockerfile
2+
Containerfile
33
.dockerignore
44
.git
55
.gitignore

.github/workflows/release.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Publish OCI Containers
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
jobs:
12+
13+
backend-container:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
attestations: write
19+
id-token: write
20+
env:
21+
REGISTRY: ghcr.io
22+
IMAGE_NAME: ${{ github.repository }}
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
- name: Log in to the Container registry
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@v5
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
- name: Build and push Docker image
39+
id: push
40+
uses: docker/build-push-action@v6
41+
with:
42+
context: .
43+
file: Containerfile
44+
push: true
45+
tags: ${{ steps.meta.outputs.tags }}
46+
labels: ${{ steps.meta.outputs.labels }}
47+
48+
- name: Generate artifact attestation
49+
uses: actions/attest-build-provenance@v2
50+
with:
51+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
52+
subject-digest: ${{ steps.push.outputs.digest }}
53+
push-to-registry: true
54+
55+
frontend-container:
56+
runs-on: ubuntu-latest
57+
permissions:
58+
contents: read
59+
packages: write
60+
attestations: write
61+
id-token: write
62+
env:
63+
REGISTRY: ghcr.io
64+
IMAGE_NAME: ${{ github.repository }}-web
65+
66+
steps:
67+
- name: Checkout repository
68+
uses: actions/checkout@v4
69+
- name: Log in to the Container registry
70+
uses: docker/login-action@v3
71+
with:
72+
registry: ${{ env.REGISTRY }}
73+
username: ${{ github.actor }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
- name: Extract metadata (tags, labels) for Docker
76+
id: meta
77+
uses: docker/metadata-action@v5
78+
with:
79+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
80+
- name: Build and push Docker image
81+
id: push
82+
uses: docker/build-push-action@v6
83+
with:
84+
context: web
85+
file: web/Containerfile
86+
push: true
87+
tags: ${{ steps.meta.outputs.tags }}
88+
labels: ${{ steps.meta.outputs.labels }}
89+
90+
- name: Generate artifact attestation
91+
uses: actions/attest-build-provenance@v2
92+
with:
93+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
94+
subject-digest: ${{ steps.push.outputs.digest }}
95+
push-to-registry: true

Containerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM ghcr.io/astral-sh/uv:python3.12-alpine
2+
3+
WORKDIR /app
4+
COPY . /app
5+
6+
RUN uv sync --locked --no-dev
7+
8+
EXPOSE 8000
9+
10+
CMD ["uv", "run", "python", "server.py", "--host", "0.0.0.0", "--port", "8000"]

Dockerfile

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

docker-compose.yml renamed to compose.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
services:
22
backend:
3-
build:
4-
context: .
5-
dockerfile: Dockerfile
3+
image: ghcr.io/codingjoe/deer-flow:main
64
container_name: deer-flow-backend
5+
pull_policy: always
76
ports:
87
- "8000:8000"
98
env_file:
@@ -15,11 +14,8 @@ services:
1514
- deer-flow-network
1615

1716
frontend:
18-
build:
19-
context: ./web
20-
dockerfile: Dockerfile
21-
args:
22-
- NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
17+
image: ghcr.io/codingjoe/deer-flow-web:main
18+
pull_policy: always
2319
container_name: deer-flow-frontend
2420
ports:
2521
- "3000:3000"

web/.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.env
2-
Dockerfile
2+
Containerfile
33
.dockerignore
44
node_modules
55
npm-debug.log

web/Containerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:20-alpine
2+
WORKDIR /app
3+
4+
ENV NODE_ENV=production
5+
ENV SKIP_ENV_VALIDATION=1
6+
ENV NEXT_TELEMETRY_DISABLED=1
7+
ENV PORT=3000
8+
9+
RUN apk add --no-cache pnpm
10+
11+
COPY . /app
12+
RUN pnpm i
13+
RUN pnpm run build
14+
15+
EXPOSE 3000
16+
17+
CMD ["pnpm", "start"]

web/Dockerfile

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

web/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ services:
22
deer-flow-web:
33
build:
44
context: .
5-
dockerfile: Dockerfile
5+
dockerfile: Containerfile
66
args:
77
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL}
88
image: deer-flow-web

0 commit comments

Comments
 (0)