forked from TransformerOptimus/SuperCoder
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
122 lines (73 loc) · 2.96 KB
/
Dockerfile
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
FROM public.ecr.aws/docker/library/golang:1.22.3-bookworm AS build-base
RUN apt-get update && apt-get install -y jq postgresql-client && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN groupadd -g 1000 coder
RUN useradd -u 1000 -g coder coder
RUN usermod -aG sudo coder
RUN echo 'coder ALL=NOPASSWD: ALL' >> /etc/sudoers
USER coder
WORKDIR /home/coder
RUN git config --global --add safe.directory /workspaces
RUN git config --global user.email "[email protected]"
RUN git config --global user.name "SuperCoder"
WORKDIR $GOPATH/src/packages/ai-developer/
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY *.go .
COPY app app
FROM build-base AS migrations
RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
COPY ./bin/migrations.sh /opt/migrations.sh
ENTRYPOINT ["bash", "-c", "/opt/migrations.sh"]
FROM build-base AS server-development
ENV PORT 8080
ENV GIN_MODE debug
EXPOSE 8080
ENTRYPOINT ["go", "run", "server.go"]
FROM build-base AS production-base
WORKDIR $GOPATH/src/packages/ai-developer/
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /go/server server.go
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /go/worker worker.go
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /go/executor executor.go
FROM build-base AS executor-base
WORKDIR $GOPATH/src/packages/ai-developer/
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /go/executor executor.go
FROM build-base AS worker-development
ENTRYPOINT ["go", "run", "worker.go"]
FROM superagidev/supercoder-python-ide:latest AS python-executor
WORKDIR /home/coder
RUN git config --global --add safe.directory /workspaces
RUN git config --global user.email "[email protected]"
RUN git config --global user.name "SuperCoder"
RUN sudo mkdir -p /opt/venv && sudo chown coder:coder /opt/venv
ENV HOME /home/coder
COPY --from=executor-base /go/executor /go/executor
COPY ./app/prompts /go/prompts
ENTRYPOINT ["bash", "-c", "/entrypoint.d/initialise.sh && /go/executor"]
FROM superagidev/supercoder-node-ide:latest AS node-executor
USER coder
WORKDIR /home/coder
RUN git config --global --add safe.directory /workspaces
RUN git config --global user.email "[email protected]"
RUN git config --global user.name "SuperCoder"
ENV HOME /home/coder
COPY --from=executor-base /go/executor /go/executor
COPY ./app/prompts /go/prompts
ENTRYPOINT ["bash", "-c", "/go/executor"]
FROM public.ecr.aws/docker/library/debian:bookworm-slim as production
# install git
RUN apt-get update && \
apt-get install -y git zip \
&& apt-get clean
RUN useradd -m coder
USER coder
RUN git config --global --add safe.directory /workspaces
RUN git config --global user.email "[email protected]"
RUN git config --global user.name "SuperCoder"
WORKDIR /go
ENV PORT 8080
ENV GIN_MODE release
EXPOSE 8080
COPY --from=production-base /go/server /go/server
COPY --from=production-base /go/worker /go/worker
COPY ./app/prompts /go/prompts