2020-02-08 00:45:22 +08:00
|
|
|
# GitHub: https://github.com/nicksherron/bashhub-server
|
|
|
|
FROM golang:1.13-alpine AS build
|
2020-02-07 16:02:18 +08:00
|
|
|
|
2020-02-08 00:45:22 +08:00
|
|
|
ARG VERSION
|
|
|
|
ARG GIT_COMMIT
|
|
|
|
ARG BUILD_DATE
|
2020-02-07 16:02:18 +08:00
|
|
|
|
2020-02-08 00:45:22 +08:00
|
|
|
ARG CGO=1
|
|
|
|
ENV CGO_ENABLED=${CGO}
|
|
|
|
ENV GOOS=linux
|
|
|
|
ENV GO111MODULE=on
|
2020-02-07 16:02:18 +08:00
|
|
|
|
|
|
|
WORKDIR /go/src/github.com/nicksherron/bashhub-server
|
|
|
|
|
2020-02-08 00:45:22 +08:00
|
|
|
COPY . /go/src/github.com/nicksherron/bashhub-server/
|
2020-02-07 16:02:18 +08:00
|
|
|
|
2020-02-08 00:45:22 +08:00
|
|
|
# gcc/g++ are required to build SASS libraries for extended version
|
|
|
|
RUN apk update && \
|
|
|
|
apk add --no-cache gcc g++ musl-dev
|
2020-02-07 16:02:18 +08:00
|
|
|
|
|
|
|
|
2020-02-08 01:17:00 +08:00
|
|
|
RUN go build -ldflags '-w -linkmode external -extldflags "-static" -X github.com/nicksherron/bashhub-server/version.GitCommit=${GIT_COMMIT} -X github.com/nicksherron/bashhub-server/version.BuildDate=${BUILD_DATE}' -o /go/bin/bashhub-server
|
2020-02-08 00:45:22 +08:00
|
|
|
|
|
|
|
# ---
|
|
|
|
|
|
|
|
FROM alpine:3.11
|
2020-02-07 16:02:18 +08:00
|
|
|
|
2020-02-08 00:45:22 +08:00
|
|
|
COPY --from=build /go/bin/bashhub-server /usr/bin/bashhub-server
|
2020-02-07 16:02:18 +08:00
|
|
|
|
2020-02-08 00:45:22 +08:00
|
|
|
# libc6-compat & libstdc++ are required for extended SASS libraries
|
|
|
|
# ca-certificates are required to fetch outside resources (like Twitter oEmbeds)
|
|
|
|
RUN apk update && \
|
|
|
|
apk add --no-cache ca-certificates libc6-compat libstdc++
|
2020-02-07 16:02:18 +08:00
|
|
|
|
2020-02-08 00:45:22 +08:00
|
|
|
VOLUME /data
|
|
|
|
WORKDIR /data
|
2020-02-07 16:02:18 +08:00
|
|
|
|
2020-02-08 00:45:22 +08:00
|
|
|
# Expose port for live server
|
2020-02-08 01:17:00 +08:00
|
|
|
EXPOSE 8080
|
2020-02-07 16:02:18 +08:00
|
|
|
|
2020-02-08 00:45:22 +08:00
|
|
|
ENTRYPOINT ["bashhub-server"]
|
|
|
|
CMD ["--help"]
|