happyDomain/Dockerfile

59 lines
1.2 KiB
Docker
Raw Normal View History

2020-10-16 08:08:18 +00:00
FROM node:alpine as nodebuild
WORKDIR /go/src/git.happydns.org/happydns
RUN apk --no-cache add python2 build-base
COPY htdocs/ htdocs/
2020-11-08 19:55:31 +00:00
RUN yarn config set network-timeout 100000
2020-10-16 08:08:18 +00:00
RUN yarn --cwd htdocs install
RUN yarn --cwd htdocs --offline build
FROM golang:alpine as gobuild
RUN apk add --no-cache go-bindata
WORKDIR /go/src/git.happydns.org/happydns
COPY --from=nodebuild /go/src/git.happydns.org/happydns/ ./
COPY admin ./admin
COPY api ./api
COPY config ./config
COPY forms ./forms
COPY generators ./generators
COPY model ./model
COPY services ./services
COPY sources ./sources
COPY storage ./storage
COPY utils ./utils
COPY generate.go go.mod go.sum main.go static.go ./
RUN sed -i '/yarn --cwd htdocs --offline build/d' static.go && \
go get -d -v && \
go generate -v && \
go build -v
FROM alpine
EXPOSE 8081
ENTRYPOINT ["/usr/sbin/happydns"]
2020-10-16 08:08:18 +00:00
ENV HAPPYDNS_LEVELDB_PATH=/data/happydns.db
VOLUME /data
RUN apk add --no-cache \
curl \
jq \
&& \
adduser --system --no-create-home --uid 15353 happydns && \
chown happydns /data
USER happydns
COPY --from=gobuild /go/src/git.happydns.org/happydns/happydns /usr/sbin/happydns
COPY hadmin.sh /usr/bin/hadmin