-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (28 loc) · 931 Bytes
/
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
FROM golang:1.21.4-alpine AS builder
WORKDIR /app
COPY go.sum go.mod ./
RUN --mount=type=cache,target=/go/pkg/mod/ \
go mod download -x
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,target=. \
go install -v ./cmd/codeactions/main.go
FROM alpine:3.18.4
RUN apk add --no-cache python3 python3-dev py3-pip ffmpeg postgresql-dev libpq libpq-dev build-base
RUN pip install psycopg2
RUN pip install psycopg2-binary
RUN pip install pymongo
ENV APP_USER=app \
APP_GROUP=app \
USER_ID=1999 \
GROUP_ID=1999
RUN addgroup --system --gid ${GROUP_ID} ${APP_GROUP} \
&& adduser --system --disabled-password --home /home/${APP_USER} \
--uid ${USER_ID} --ingroup ${APP_GROUP} ${APP_USER}
COPY --from=builder --chown=${APP_USER}:${APP_GROUP} /go/bin /app
WORKDIR /app
COPY ./engines ./engines
USER ${APP_USER}:${APP_GROUP}
RUN chmod -R u+w /home/app
EXPOSE 8080
CMD ["./main"]