GoBlog/Dockerfile

42 lines
1.1 KiB
Docker
Raw Normal View History

2022-08-02 19:10:27 +00:00
FROM golang:1.19-alpine3.16 as buildbase
2021-12-06 19:06:26 +00:00
2020-09-24 17:04:28 +00:00
WORKDIR /app
RUN apk add --no-cache git gcc musl-dev
2021-04-14 20:07:37 +00:00
RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main sqlite-dev
ENV GOFLAGS="-tags=linux,libsqlite3,sqlite_fts5"
2021-06-18 13:33:08 +00:00
ADD *.go go.mod go.sum /app/
ADD pkgs/ /app/pkgs/
ADD testdata/ /app/testdata/
2021-07-19 16:44:51 +00:00
ADD templates/ /app/templates/
ADD leaflet/ /app/leaflet/
ADD hlsjs/ /app/hlsjs/
ADD dbmigrations/ /app/dbmigrations/
ADD strings/ /app/strings/
FROM buildbase as build
RUN go build -ldflags '-w -s' -o GoBlog
2020-09-24 17:04:28 +00:00
2022-04-16 04:22:14 +00:00
FROM build as test
2022-07-17 06:36:10 +00:00
RUN go test -timeout 300s -failfast -cover ./...
2022-04-16 04:22:14 +00:00
FROM alpine:3.16 as base
2021-12-06 19:06:26 +00:00
2020-09-24 17:04:28 +00:00
WORKDIR /app
VOLUME /app/config
VOLUME /app/data
EXPOSE 80
EXPOSE 443
EXPOSE 8080
CMD ["GoBlog"]
2021-04-11 14:08:29 +00:00
HEALTHCHECK --interval=1m --timeout=10s CMD GoBlog healthcheck
RUN apk add --no-cache tzdata tor
2021-04-14 20:07:37 +00:00
RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main sqlite-dev
2021-04-11 14:08:29 +00:00
COPY templates/ /app/templates/
2021-12-06 19:06:26 +00:00
COPY --from=build /app/GoBlog /bin/
FROM base as tools
RUN apk add --no-cache curl bash git
RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main sqlite