2024-01-02 14:36:27 +00:00
|
|
|
FROM golang:1.21-alpine3.19 as buildbase
|
|
|
|
|
2020-03-29 08:48:43 +00:00
|
|
|
WORKDIR /app
|
2021-09-04 09:42:36 +00:00
|
|
|
ENV CGO_ENABLED=0
|
2021-08-11 13:07:28 +00:00
|
|
|
ADD *.go go.mod go.sum /app/
|
|
|
|
ADD templates/ /app/templates/
|
2024-01-02 14:36:27 +00:00
|
|
|
|
|
|
|
FROM buildbase AS build
|
|
|
|
|
2021-08-10 20:34:25 +00:00
|
|
|
RUN go build -ldflags '-w -s' -o goshort
|
2020-03-29 08:48:43 +00:00
|
|
|
|
2024-01-02 14:36:27 +00:00
|
|
|
FROM build AS test
|
|
|
|
|
|
|
|
RUN go test -timeout 300s -failfast -cover ./...
|
|
|
|
|
|
|
|
FROM alpine:3.19 AS base
|
|
|
|
|
2020-03-29 08:48:43 +00:00
|
|
|
WORKDIR /app
|
|
|
|
VOLUME /app/config
|
|
|
|
VOLUME /app/data
|
|
|
|
EXPOSE 8080
|
2021-08-10 20:34:25 +00:00
|
|
|
CMD ["goshort"]
|
|
|
|
COPY --from=build /app/goshort /bin/
|