-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
57 lines (48 loc) · 1.46 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
51
52
53
54
55
56
57
# syntax=docker/dockerfile:experimental
############################
# STEP 2 build executable binary
############################
# FROM golang:alpine AS builder
FROM public.ecr.aws/docker/library/golang:1.19 as builder
RUN update-ca-certificates
# RUN apk update && apk add --no-cache git
# Create zincsearch user.
ENV USER=gateway
ENV GROUP=gateway
ENV UID=10001
ENV GID=10001
# See https://stackoverflow.com/a/55757473/12429735RUN
RUN groupadd --gid "${GID}" "${GROUP}"
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
--gid "${GID}" \
"${USER}"
WORKDIR $GOPATH/src/gateway
COPY ./gateway $GOPATH/src/gateway/
#COPY ./fs-lib-public $GOPATH/src/fs-lib-public/
RUN go mod tidy
RUN go build -o wzinc
############################
# STEP 3 build a small image
############################
FROM ubuntu:latest
# Import the user and group files from the builder.
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
# Copy our static executable.
COPY --from=builder /go/src/gateway/wzinc /go/bin/wzinc
RUN apt-get update
RUN apt-get install -y poppler-utils wv unrtf tidy
RUN apt-get install -y inotify-tools
RUN apt-get install -y ca-certificates curl
# RUN sysctl -w fs.inotify.max_user_watches=8192
# Use an unprivileged user.
USER gateway:gateway
# Port on which the gateway service will be exposed.
EXPOSE 6317
CMD /go/bin/wzinc start