-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (33 loc) · 1.11 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
# Stage 1: Build the binary
FROM golang:1.23.4 AS builder
LABEL stage="gobuilder" [email protected]
ENV CGO_ENABLED=0 GOOS=linux
WORKDIR /build
ADD go.mod .
ADD go.sum .
RUN go mod download
COPY . .
RUN go build -o /app/soloanvill_backend ./cmd/main.go
# Stage 2: Run the app
FROM alpine:3.21
COPY --from=builder /app/soloanvill_backend /usr/local/bin/
RUN apk update && apk update --no-cache && apk add --no-cache tzdata && \
adduser -D -u 1001 -G root soloanvill && \
mkdir -p /app && \
mkdir /etc/soloanvill && \
chmod +x /usr/local/bin/soloanvill_backend && \
chown -R soloanvill:0 /app && \
chown -R soloanvill:0 /etc/soloanvill
ENV TZ=Europe/Moscow
ENV SOLOANVILL_DATABASE_HOST=127.0.0.1
ENV SOLOANVILL_DATABASE_PORT=5432
ENV SOLOANVILL_DATABASE_NAME=soloanvill
ENV SOLOANVILL_DATABASE_USER=soloanvill
ENV SOLOANVILL_DATABASE_PASSWORD=password
ENV SOLOANVILL_JENKINS_HOST=127.0.0.1
ENV SOLOANVILL_JENKINS_LOGIN=JENKINS_LOGIN
ENV SOLOANVILL_JENKINS_TOKEN=JENKINS_TOKEN
WORKDIR /etc/soloanvill
EXPOSE 8080
USER 1001
CMD ["/usr/local/bin/soloanvill_backend"]