Skip to content

Instantly share code, notes, and snippets.

@drdaeman
Created January 9, 2018 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drdaeman/94234878c1096490fdef749459f1e19e to your computer and use it in GitHub Desktop.
Save drdaeman/94234878c1096490fdef749459f1e19e to your computer and use it in GitHub Desktop.
Dockerfile to build oklog/oklog
FROM node:9 AS build-ui
RUN npm install -g elm --unsafe-perm=true --allow-root
COPY ./ui /app/ui
RUN cd /app/ui \
&& ([ ! -e elm-stuff ] || rm -rf elm-stuff) \
&& elm-make --yes src/Main.elm --output=scripts/oklog.js
# ============================================================================
FROM golang:1.9-alpine AS build-cli
RUN apk add --no-cache git \
&& go get github.com/golang/dep/cmd/dep \
&& go get -u github.com/mjibson/esc
COPY . /go/src/github.com/oklog/oklog
WORKDIR /go/src/github.com/oklog/oklog
COPY --from=build-ui \
/app/ui/scripts/oklog.js /go/src/github.com/oklog/oklog/ui/scripts/oklog.js
RUN dep ensure \
&& esc -pkg ui \
-ignore '.git*|elm-*|node_modules|src|tests|Makefile|package-lock.json' \
-o pkg/ui/static.go ui/ \
&& go build -o oklog ./cmd/...
# ============================================================================
FROM alpine:3.6
COPY --from=build-cli /go/src/github.com/oklog/oklog/oklog /oklog
ENTRYPOINT ["/oklog"]
VOLUME /data
EXPOSE 7659 7651 7653 7650
LABEL vendor=https://github.com/oklog/oklog \
oklog.version=v0.3.1dev-linux-amd64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment