-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (29 loc) · 774 Bytes
/
Dockerfile
File metadata and controls
49 lines (29 loc) · 774 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
39
40
41
42
43
44
45
46
47
48
49
FROM golang:1.19-alpine AS build_base
# WE NEED GIT
RUN apk update && apk add --no-cache git
COPY src/ /src
RUN ls src
WORKDIR /src
# Enables watch functionality
RUN go install github.com/mitranim/gow@latest
RUN go build -o /userservice
CMD ["gow", "run", "."]
#USER appuser
FROM alpine:3.9
RUN mkdir /app
COPY --from=build_base userservice /app/userservice
WORKDIR /app
RUN adduser -S -D appuser
RUN chown appuser ./userservice
RUN chmod +x /app/userservice
# USE THE APPLICATION-USER
USER appuser
# SET ENVIRONMENT-VARIABLES
# override these while running image
ENV DATABASE_PASSWORD=""
ENV DATABASE_USERNAME="root"
ENV DATABASE_HOSTNAME="localhost"
ENV DATABASE_PORT="3306"
ENV DATABASE_DATABASE="flightloguser"
CMD ["/app/userservice"]
EXPOSE 61226