Added dockerfile
This commit is contained in:
parent
4342adc195
commit
b516a45e24
|
|
@ -0,0 +1,38 @@
|
|||
## Build
|
||||
FROM golang:1.19-buster AS build
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY go.mod ./
|
||||
COPY go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY *.go ./
|
||||
COPY app/*.go ./app/
|
||||
COPY config/*.go ./config/
|
||||
COPY routes/*.go ./routes/
|
||||
COPY services/*.go ./services/
|
||||
|
||||
RUN go build -o /basic-sensor-receiver
|
||||
RUN mkdir /data
|
||||
|
||||
## Deploy
|
||||
FROM gcr.io/distroless/base-debian10
|
||||
|
||||
WORKDIR /
|
||||
|
||||
COPY --from=build /basic-sensor-receiver /basic-sensor-receiver
|
||||
COPY --from=build /data /data
|
||||
COPY client ./client
|
||||
|
||||
ENV PORT 80
|
||||
ENV GIN_MODE release
|
||||
ENV DATABASE_URL /data/sensors.sqlite3
|
||||
ENV BIND_IP 0.0.0.0
|
||||
ENV AUTH_USERNAME admin
|
||||
ENV AUTH_PASSWORD password
|
||||
|
||||
EXPOSE ${PORT}
|
||||
VOLUME [ "/data" ]
|
||||
|
||||
ENTRYPOINT ["/basic-sensor-receiver"]
|
||||
Loading…
Reference in New Issue