-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContainerFile.local
More file actions
69 lines (50 loc) · 2.12 KB
/
Copy pathContainerFile.local
File metadata and controls
69 lines (50 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Local development build — uses source dir copied into build context by build-local.sh.
# DO NOT run podman build directly; use: ./build-local.sh
ARG TARGETARCH
# Stage 1: Build tinycode binary from Go source
FROM registry.access.redhat.com/ubi9/ubi AS builder
ARG TARGETARCH
RUN dnf install -y git make && dnf clean all
# Install Go
ARG GO_VERSION=1.27.1
RUN ARCH=$(uname -m) && \
case "$ARCH" in x86_64) GO_ARCH=amd64 ;; aarch64) GO_ARCH=arm64 ;; *) GO_ARCH=amd64 ;; esac && \
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz" | tar -C /usr/local -xz
ENV PATH="/usr/local/go/bin:$PATH"
# Source copied into build context by build-local.sh
COPY tinycode-src/ /build/tinycode/
WORKDIR /build/tinycode
RUN GOOS=linux GOARCH=$TARGETARCH CGO_ENABLED=0 \
go build -ldflags "-s -w" -o /build/tinycode-binary ./cmd/tinycode
# Stage 2: Runtime
FROM registry.access.redhat.com/ubi9/ubi-minimal AS runtime
ARG TARGETARCH
RUN microdnf install -y shadow-utils tar gzip git-core python3.11 python3.11-pip nodejs npm && \
python3.11 -m pip install --no-cache-dir ansible-lint && \
microdnf clean all
RUN useradd -u 1001 -r -g 0 -m -s /sbin/nologin tinycode && \
microdnf remove -y shadow-utils && microdnf clean all
COPY --from=builder /build/tinycode-binary /usr/local/bin/tinycode
COPY plugins/ /opt/tinycode-plugins/
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
COPY config/agent /opt/tinycode-defaults/agent
COPY config/skills /opt/tinycode-defaults/skills
ENV XDG_DATA_HOME=/home/tinycode/.local/share \
XDG_CONFIG_HOME=/home/tinycode/.config \
XDG_STATE_HOME=/home/tinycode/.local/state \
XDG_CACHE_HOME=/home/tinycode/.cache \
HOME=/home/tinycode \
SHELL=/bin/sh \
PATH="/home/tinycode/.local/bin:${PATH}"
RUN mkdir -p \
/home/tinycode/.local/share/tinycode \
/home/tinycode/.config/tinycode \
/home/tinycode/.local/state/tinycode \
/home/tinycode/.cache/tinycode && \
chown -R 1001:0 /home/tinycode && \
chmod -R g=u /home/tinycode
EXPOSE 4096
USER 1001
WORKDIR /projects
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]