Skip to content

Commit efb62d1

Browse files
author
Gleez Technologies
committed
update: Added missing Dockerfile
1 parent d3b4d2c commit efb62d1

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

Dockerfile

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
############################
2+
# STEP 1 build executable binary
3+
############################
4+
FROM golang:1.14 AS builder
5+
6+
ADD . /go/src/github.com/sandeepone/mysql-manticore
7+
8+
RUN cd /go/src/github.com/sandeepone/mysql-manticore \
9+
&& COMMIT_SHA=$(git rev-parse --short HEAD) \
10+
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w \
11+
-X main.version=0.8.0 \
12+
-X main.revision=${COMMIT_SHA}" \
13+
-a -tags netgo -installsuffix netgo -o mysql-manticore cmd/mysql-manticore/main.go
14+
15+
############################
16+
# STEP 2 build a certs image
17+
############################
18+
19+
# Alpine certs
20+
FROM alpine:3.11 as alpine
21+
22+
RUN apk update && apk add --no-cache ca-certificates tzdata && update-ca-certificates
23+
24+
# Create appuser
25+
ENV USER=appuser
26+
ENV UID=10001
27+
28+
# See https://stackoverflow.com/a/55757473/12429735
29+
RUN adduser \
30+
--disabled-password \
31+
--gecos "" \
32+
--home "/nonexistent" \
33+
--shell "/sbin/nologin" \
34+
--no-create-home \
35+
--uid "${UID}" \
36+
"${USER}"
37+
38+
############################
39+
# STEP 3 build a release image
40+
############################
41+
FROM scratch
42+
MAINTAINER Sandeep Sangamreddi <[email protected]>
43+
44+
# Import from builder.
45+
COPY --from=alpine /usr/share/zoneinfo /usr/share/zoneinfo
46+
COPY --from=alpine /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
47+
COPY --from=alpine /etc/passwd /etc/passwd
48+
COPY --from=alpine /etc/group /etc/group
49+
50+
COPY --from=builder /go/src/github.com/sandeepone/mysql-manticore/mysql-manticore /usr/bin/
51+
COPY etc/river.toml /etc/mysql-manticore/river.toml
52+
COPY etc/dict /etc/mysql-manticore/dict
53+
54+
EXPOSE 8080
55+
56+
# Use an unprivileged user.
57+
USER appuser:appuser
58+
59+
ENTRYPOINT ["mysql-manticore", "-config", "/etc/mysql-manticore/river.toml"]

0 commit comments

Comments
 (0)