GoBlog/Dockerfile

45 lines
1.2 KiB
Docker
Raw Permalink Normal View History

2024-02-08 18:40:49 +00:00
FROM golang:1.22-alpine3.19 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
RUN apk add --no-cache --repository=https://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/
ADD plugins/ /app/plugins/
2022-11-27 14:08:48 +00:00
ADD logo/GoBlog.png /app/logo/GoBlog.png
2023-12-20 14:19:54 +00:00
FROM buildbase AS build
2022-10-22 18:29:45 +00:00
RUN go build -ldflags '-w -s' -o GoBlog
2020-09-24 17:04:28 +00:00
2023-12-20 14:19:54 +00:00
FROM build AS test
2022-04-16 04:22:14 +00:00
2022-07-17 06:36:10 +00:00
RUN go test -timeout 300s -failfast -cover ./...
2022-04-16 04:22:14 +00:00
2024-02-08 18:40:49 +00:00
FROM alpine:3.19 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
ENV GOMEMLIMIT=100MiB
RUN apk add --no-cache tzdata tor
RUN apk add --no-cache --repository=https://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/
2023-12-20 14:19:54 +00:00
FROM base AS tools
2021-12-06 19:06:26 +00:00
RUN apk add --no-cache curl bash git
RUN apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/main sqlite