-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
40 lines (26 loc) · 839 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
38
39
40
# syntax=docker/dockerfile
# Install golang
# Build Stage
FROM golang:1.18-alpine3.15 AS builder
ENV WRK_DIR /app
# Copy the contents to /app
COPY . $WRK_DIR
# Set working directory
WORKDIR $WRK_DIR
# Toggle CGO based on your app requirement. CGO_ENABLED=1 for enabling CGO
RUN CGO_ENABLED=0 go build -ldflags '-s -w -extldflags "-static"' -o $WRK_DIR/appbin $WRK_DIR
COPY docker /app/docker
#
# Run Stage
#
FROM alpine:3.15
MAINTAINER CZERTAINLY <support@czertainly.com>
# add non root user czertainly
RUN addgroup --system --gid 10001 czertainly && adduser --system --home /opt/czertainly --uid 10001 --ingroup czertainly czertainly
COPY --from=builder /app/docker /
COPY --from=builder /app /opt/czertainly
WORKDIR /opt/czertainly
ENV SERVER_PORT=8080
ENV LOG_LEVEL=INFO
USER 10001
ENTRYPOINT ["/opt/czertainly/entry.sh"]