-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
executable file
·85 lines (55 loc) · 2.12 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# -----------------------------------------------------------------------------
# Stages
# -----------------------------------------------------------------------------
ARG IMAGE_BUILDER=golang:1.23.4-bookworm
ARG IMAGE_FINAL=senzing/senzingsdk-runtime-beta:latest
# -----------------------------------------------------------------------------
# Stage: senzingsdk_runtime
# -----------------------------------------------------------------------------
FROM ${IMAGE_FINAL} AS senzingsdk_runtime
# -----------------------------------------------------------------------------
# Stage: builder
# -----------------------------------------------------------------------------
FROM ${IMAGE_BUILDER} AS builder
ENV REFRESHED_AT=2024-07-01
LABEL Name="senzing/go-builder" \
Maintainer="support@senzing.com" \
Version="0.1.0"
# Run as "root" for system installation.
USER root
# Copy local files from the Git repository.
COPY ./rootfs /
COPY . ${GOPATH}/src/template-go
# Copy files from prior stage.
COPY --from=senzingsdk_runtime "/opt/senzing/er/lib/" "/opt/senzing/er/lib/"
COPY --from=senzingsdk_runtime "/opt/senzing/er/sdk/c/" "/opt/senzing/er/sdk/c/"
# Set path to Senzing libs.
ENV LD_LIBRARY_PATH=/opt/senzing/er/lib/
# Build go program.
WORKDIR ${GOPATH}/src/template-go
RUN make build
# Copy binaries to /output.
RUN mkdir -p /output \
&& cp -R ${GOPATH}/src/template-go/target/* /output/
# -----------------------------------------------------------------------------
# Stage: final
# -----------------------------------------------------------------------------
FROM ${IMAGE_FINAL} AS final
ENV REFRESHED_AT=2024-07-01
LABEL Name="senzing/template-go" \
Maintainer="support@senzing.com" \
Version="0.0.1"
HEALTHCHECK CMD ["/app/healthcheck.sh"]
USER root
# Install packages via apt-get.
# Copy files from repository.
COPY ./rootfs /
# Copy files from prior stage.
COPY --from=builder /output/linux/template-go /app/template-go
# Run as non-root container
USER 1001
# Runtime environment variables.
ENV LD_LIBRARY_PATH=/opt/senzing/er/lib/
# Runtime execution.
WORKDIR /app
ENTRYPOINT ["/app/template-go"]