Skip to content

Commit 5ede6ff

Browse files
committed
chore: initialize codex queue bot
0 parents  commit 5ede6ff

29 files changed

Lines changed: 3450 additions & 0 deletions

.dockerignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.git
2+
.github
3+
.env*
4+
config.json
5+
config.*.json
6+
openilink-tools.json
7+
codex-queue-bot
8+
*.log
9+
*.pid
10+
.codex
11+
secrets
12+
credentials
13+
*.pem
14+
*.key
15+
*.p12
16+
*.pfx

.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
OPENILINK_APP_TOKEN=replace-with-openilink-app-token
2+
CODEX_KEY_PRIMARY=replace-with-primary-key
3+
CODEX_KEY_BACKUP=replace-with-backup-key
4+
5+
# Optional outbound proxy. A single proxy variable is enough; the service
6+
# applies it to Hub HTTP/WebSocket traffic and Codex API requests.
7+
# HTTP_PROXY=socks5://host.docker.internal:1080
8+
# NO_PROXY=localhost,127.0.0.1
9+
10+
# Optional image override. Compose defaults to the latest GHCR image.
11+
# CODEX_QUEUE_BOT_IMAGE=ghcr.io/alliottech/codex-queue-bot:latest

.github/workflows/container.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Build and publish container
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
pull_request:
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: container-${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Check out repository
26+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27+
28+
- name: Set lowercase image name
29+
id: image
30+
shell: bash
31+
run: echo "name=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
32+
33+
- name: Set up QEMU
34+
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
35+
36+
- name: Set up Docker Buildx
37+
uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
38+
39+
- name: Log in to GHCR
40+
if: github.event_name != 'pull_request'
41+
uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
42+
with:
43+
registry: ghcr.io
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
47+
- name: Generate image metadata
48+
id: meta
49+
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
50+
with:
51+
images: ${{ steps.image.outputs.name }}
52+
tags: |
53+
type=raw,value=latest,enable={{is_default_branch}}
54+
type=ref,event=branch
55+
type=ref,event=tag
56+
type=sha,prefix=sha-
57+
58+
- name: Build and publish image
59+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
60+
with:
61+
context: .
62+
platforms: linux/amd64,linux/arm64
63+
push: ${{ github.event_name != 'pull_request' }}
64+
tags: ${{ steps.meta.outputs.tags }}
65+
labels: ${{ steps.meta.outputs.labels }}
66+
build-args: |
67+
CODEX_VERSION=latest
68+
VERSION=${{ github.sha }}
69+
cache-from: type=gha
70+
cache-to: type=gha,mode=max
71+
provenance: mode=max
72+
sbom: true

.gitignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.env
2+
.env.*
3+
!.env.example
4+
5+
config.json
6+
config.*.json
7+
!config.example.json
8+
openilink-tools.json
9+
10+
.codex/
11+
secrets/
12+
credentials/
13+
*.pem
14+
*.key
15+
*.p12
16+
*.pfx
17+
18+
codex-queue-bot
19+
*.log
20+
*.pid
21+
*.out
22+
.DS_Store

Dockerfile

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM --platform=$BUILDPLATFORM golang:1.24-alpine AS builder
4+
5+
ARG TARGETOS
6+
ARG TARGETARCH
7+
ARG VERSION=dev
8+
9+
WORKDIR /src
10+
COPY go.mod go.sum ./
11+
RUN go mod download
12+
COPY cmd ./cmd
13+
COPY internal ./internal
14+
RUN CGO_ENABLED=0 GOOS="${TARGETOS}" GOARCH="${TARGETARCH}" \
15+
go build -trimpath -ldflags="-s -w -X main.version=${VERSION}" \
16+
-o /out/codex-queue-bot ./cmd/codex-queue-bot
17+
18+
FROM node:22-bookworm-slim AS codex-dist
19+
20+
ARG CODEX_VERSION=latest
21+
RUN --mount=type=cache,target=/root/.npm \
22+
npm install --global "@openai/codex@${CODEX_VERSION}" \
23+
&& CODEX_NATIVE="$(find /usr/local/lib/node_modules/@openai/codex/node_modules/@openai -type f -path '*/bin/codex' -print -quit)" \
24+
&& test -n "${CODEX_NATIVE}" \
25+
&& install -D -m 0755 "${CODEX_NATIVE}" /out/codex \
26+
&& /out/codex --version
27+
28+
FROM debian:bookworm-slim
29+
30+
# Keep Debian packages on the current security-patched versions from the base image.
31+
# hadolint ignore=DL3008
32+
RUN apt-get update \
33+
&& apt-get install -y --no-install-recommends ca-certificates tini \
34+
&& groupadd --gid 10001 app \
35+
&& useradd --create-home --uid 10001 --gid 10001 --shell /usr/sbin/nologin app \
36+
&& rm -rf /var/lib/apt/lists/*
37+
38+
WORKDIR /app
39+
COPY --from=builder /out/codex-queue-bot /usr/local/bin/codex-queue-bot
40+
COPY --from=codex-dist /out/codex /usr/local/bin/codex
41+
COPY prompts.txt /app/prompts.txt
42+
43+
USER 10001:10001
44+
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/codex-queue-bot"]
45+
CMD ["-config", "/app/config.json"]

0 commit comments

Comments
 (0)