Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use multi-stage build for dockerfile #107

Merged
merged 1 commit into from
Apr 4, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
FROM checkr/flagr-ci

VOLUME ["/data"]

FROM checkr/flagr-ci as builder
WORKDIR /go/src/github.com/checkr/flagr
ADD . .
ADD ./buildscripts/demo_sqlite3.db /data/demo_sqlite3.db
RUN cd ./browser/flagr-ui/ && yarn install && yarn run build
RUN make build

FROM alpine:3.6
RUN apk add --no-cache libc6-compat
WORKDIR /go/src/github.com/checkr/flagr
VOLUME ["/data"]
ADD ./buildscripts/demo_sqlite3.db /data/demo_sqlite3.db
ENV FLAGR_DB_DBCONNECTIONSTR=/data/demo_sqlite3.db
ENV FLAGR_RECORDER_ENABLED=false
ENV HOST=0.0.0.0
ENV PORT=18000

RUN cd ./browser/flagr-ui/ && yarn install && yarn run build
RUN make build

COPY --from=builder /go/src/github.com/checkr/flagr/flagr ./flagr
COPY --from=builder /go/src/github.com/checkr/flagr/browser/flagr-ui/dist ./browser/flagr-ui/dist
EXPOSE 18000
CMD ./flagr