-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (42 loc) · 1.49 KB
/
Dockerfile
File metadata and controls
51 lines (42 loc) · 1.49 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
FROM golang:1.25-bookworm AS dependencies
RUN apt update
RUN apt install -y build-essential
RUN apt-get install ca-certificates -y
RUN gcc --version
WORKDIR /code
COPY go.mod go.sum ./
RUN go mod download -x
RUN go install github.com/a-h/templ/cmd/[email protected]
RUN go install github.com/swaggo/swag/cmd/[email protected]
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
FROM dependencies AS build
RUN mkdir data
COPY main.go Taskfile.yml ./
COPY darkstat darkstat
COPY darkrelay darkrelay
COPY configs configs
COPY darkcore darkcore
COPY darkapis darkapis
COPY darkmap darkmap
COPY helpers helpers
# building golang gazilion times faster
ENV GOCACHE=/root/.cache/go-build
RUN templ generate
RUN swag init --parseDependency
ARG BUILD_VERSION
RUN echo "${BUILD_VERSION}" > darkstat/settings/version.txt
ENV GOEXPERIMENT=greenteagc
RUN --mount=type=cache,target="/root/.cache/go-build" go build -v -o main main.go
FROM debian:12.11-slim AS runner
WORKDIR /code
RUN mkdir data
COPY --from=build /code/main main
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ARG BUILD_VERSION
ENV BUILD_VERSION="${BUILD_VERSION}"
ENTRYPOINT /code/main
EXPOSE 8000
CMD web
HEALTHCHECK --interval=28s CMD /code/main health
# test command
# docker run -v /home/naa/apps/freelancer_related/wine_prefix_freelancer_online/drive_c/Discovery:/discovery -it -e FREELANCER_FOLDER=/discovery -p 8000:8000 -e DARKSTAT_LOG_LEVEL=DEBUG -e UTILS_LOG_LEVEL=DEBUG -e DEV_ENV=true -p 8080:8080 test