Skip to content

Commit da48ec5

Browse files
committed
feat: 🎉added Dockerfile and Makefile
1 parent d457731 commit da48ec5

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*

Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
FROM node:22-slim AS builder
2+
3+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
4+
5+
ARG USERNAME=codex
6+
ARG UID=1000
7+
ARG GID=1000
8+
ARG CODEX_CLI_VERSION=latest
9+
10+
RUN sed -i "/^[^:]*:x:${GID}:/d" /etc/group \
11+
&& sed -i "/^[^:]*:x:${UID}:/d" /etc/passwd \
12+
&& echo "${USERNAME}:x:${UID}:${GID}::/home/${USERNAME}:/sbin/nologin" >> /etc/passwd \
13+
&& echo "${USERNAME}:x:${GID}:" >> /etc/group \
14+
&& mkdir -p /home/${USERNAME} \
15+
&& chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
16+
17+
# hadolint ignore=DL3008
18+
RUN apt-get update && apt-get install -y --no-install-recommends \
19+
ca-certificates \
20+
git \
21+
git-lfs \
22+
curl \
23+
gnupg \
24+
jq \
25+
ripgrep \
26+
tzdata \
27+
wget \
28+
unzip \
29+
zip \
30+
&& rm -rf /var/lib/apt/lists/*
31+
32+
RUN npm install -g "@openai/codex@${CODEX_CLI_VERSION}"
33+
34+
USER ${USERNAME}
35+
WORKDIR /work
36+
37+
ENTRYPOINT ["codex"]

Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Simple Makefile to build and clean the local Docker image
2+
3+
IMAGE ?= codex-cli
4+
TAG ?= dev
5+
IMAGE_REF := $(IMAGE):$(TAG)
6+
DOCKERFILE ?= Dockerfile
7+
CONTEXT ?= .
8+
9+
.PHONY: build clean
10+
11+
build:
12+
docker build -t $(IMAGE_REF) -f $(DOCKERFILE) $(CONTEXT)
13+
14+
clean:
15+
@echo "Removing image $(IMAGE_REF) if it exists..."
16+
- docker image inspect $(IMAGE_REF) >/dev/null 2>&1 && docker rmi $(IMAGE_REF) || true

0 commit comments

Comments
 (0)