WeatherService/Dockerfile

28 lines
438 B
Docker
Raw Normal View History

2020-07-20 20:03:08 +02:00
FROM golang:latest as builder
2020-07-21 12:52:34 +02:00
LABEL maintainer="Johannes Theiner <kontakt@joethei.xyz>"
2020-07-20 20:33:31 +02:00
2020-07-21 11:39:37 +02:00
COPY . /
2020-07-20 20:33:31 +02:00
WORKDIR /src
2020-07-20 18:06:32 +02:00
2020-07-21 11:39:37 +02:00
ENV GO111MODULE=on
2020-07-21 12:52:34 +02:00
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
2020-07-21 11:39:37 +02:00
RUN go mod download
RUN cd server
RUN go mod download
RUN cd ..
2020-07-21 12:52:34 +02:00
RUN go build -a -tags netgo -ldflags '-w' .
RUN ls -la
2020-07-20 19:42:18 +02:00
2020-07-20 20:03:08 +02:00
FROM alpine:latest
WORKDIR /
2020-07-21 11:39:37 +02:00
COPY --from=builder /src/weather .
2020-07-21 12:52:34 +02:00
RUN ls -la
RUN chmod +x ./weather
2020-07-20 18:06:32 +02:00
2020-07-21 12:52:34 +02:00
ENTRYPOINT ["/weather"]
2020-07-21 11:48:52 +02:00
EXPOSE 8080