Add Dockerfile

This commit is contained in:
nemunaire 2020-10-16 10:08:18 +02:00
parent b93b0b5872
commit 96a886ddc4
2 changed files with 53 additions and 0 deletions

5
.dockerignore Normal file
View File

@ -0,0 +1,5 @@
happydns
bindata.go
vendor/
happydns.db/
htdocs/node_modules/

48
Dockerfile Normal file
View File

@ -0,0 +1,48 @@
FROM node:alpine as nodebuild
WORKDIR /go/src/git.happydns.org/happydns
RUN apk --no-cache add python2 build-base
COPY htdocs/ htdocs/
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
CMD ["happydns"]
ENV HAPPYDNS_LEVELDB_PATH=/data/happydns.db
VOLUME /data
COPY --from=gobuild /go/src/git.happydns.org/happydns/happydns /usr/sbin/happydns