-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (24 loc) · 853 Bytes
/
Dockerfile
File metadata and controls
28 lines (24 loc) · 853 Bytes
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
FROM golang:1.24-alpine3.21 as builder
WORKDIR /build
ARG version
ENV version_env=$version
ARG app_name
ENV app_name_env=$app_name
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download -x
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,target=. \
go build -ldflags="-X 'main.version=$version_env'" -o /main .
FROM alpine:3.21
RUN apk add --no-cache tzdata bash-completion jq
RUN cp /usr/share/zoneinfo/Europe/Moscow /etc/localtime
RUN echo "Europe/Moscow" > /etc/timezone
ARG app_name
ENV app_name_env=$app_name
COPY --from=builder main /usr/bin/$app_name_env
COPY /conf/config.yml /etc/$app_name_env/config.yml
COPY /static/autocomplete /etc/bash_completion.d/$app_name_env
CMD ["exec $app_name_env"]