-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathDockerfile
37 lines (25 loc) · 916 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
# Build container
FROM golang:1.22 AS builder
RUN go version
RUN apt-get update && apt-get upgrade -y && apt-get install -y ca-certificates git zlib1g-dev
COPY . /go/src/github.com/TicketsBot/worker
WORKDIR /go/src/github.com/TicketsBot/worker
RUN git submodule update --init --recursive --remote
RUN set -Eeux && \
go mod download && \
go mod verify
RUN GOOS=linux GOARCH=amd64 \
go build \
-tags=jsoniter \
-trimpath \
-o main cmd/worker/main.go
# Prod container
FROM ubuntu:latest
RUN apt-get update && apt-get upgrade -y && apt-get install -y ca-certificates curl
COPY --from=builder /go/src/github.com/TicketsBot/worker/locale /srv/worker/locale
COPY --from=builder /go/src/github.com/TicketsBot/worker/main /srv/worker/main
RUN chmod +x /srv/worker/main
RUN useradd -m container
USER container
WORKDIR /srv/worker
CMD ["/srv/worker/main"]