-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (35 loc) · 764 Bytes
/
Dockerfile
File metadata and controls
38 lines (35 loc) · 764 Bytes
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
###############
# BUILD IMAGE #
###############
FROM golang:alpine as builder
WORKDIR /tmp/build
COPY . .
RUN CGO_ENABLED=0 go build -o app ./cmd/tesla-http-api
###############
# FINAL IMAGE #
###############
FROM alpine:latest
ENV USER=tesla-http-api
ENV GROUPNAME=$USER
ENV UID=93761
ENV GID=93761
ENV APP_PATH=/var/lib/tesla-http-api
RUN apk --no-cache add tzdata ca-certificates
COPY --from=builder /tmp/build/app /
RUN mkdir -p $APP_PATH
RUN addgroup \
--gid "$GID" \
"$GROUPNAME" \
&& adduser \
--disabled-password \
--gecos "" \
--home "$APP_PATH" \
--ingroup "$GROUPNAME" \
--no-create-home \
--uid "$UID" \
$USER
RUN chown -R $UID:$GID $APP_PATH
WORKDIR $APP_PATH
USER tesla-http-api
ENTRYPOINT ["/app"]
EXPOSE 8080