2019-01-21 10:17:39 +00:00
|
|
|
FROM golang:alpine as builder
|
|
|
|
RUN apk --update --no-cache add make git g++
|
|
|
|
|
|
|
|
# Build statically linked vDB binary (wonky path because of Dep)
|
|
|
|
RUN mkdir -p /go/src/github.com/vulcanize/vulcanizedb
|
|
|
|
ADD . /go/src/github.com/vulcanize/vulcanizedb
|
|
|
|
WORKDIR /go/src/github.com/vulcanize/vulcanizedb
|
|
|
|
RUN GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' .
|
|
|
|
|
2019-01-24 16:13:55 +00:00
|
|
|
# Build migration tool
|
|
|
|
RUN go get -u -d github.com/pressly/goose/cmd/goose
|
|
|
|
WORKDIR /go/src/github.com/pressly/goose/cmd/goose
|
|
|
|
RUN GCO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -tags='no_mysql no_sqlite' -o goose
|
|
|
|
|
2019-01-21 10:17:39 +00:00
|
|
|
# Second stage
|
2019-01-24 16:13:55 +00:00
|
|
|
FROM alpine
|
2019-01-30 12:18:24 +00:00
|
|
|
RUN apk --no-cache --update add openrc
|
|
|
|
RUN mkdir -p /run/openrc/ && touch /run/openrc/softlevel
|
2019-01-21 10:17:39 +00:00
|
|
|
COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/vulcanizedb /app/vulcanizedb
|
2019-01-30 12:18:24 +00:00
|
|
|
COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/environments/staging.toml /app/environments/
|
|
|
|
COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/dockerfiles/lightSync-service /etc/init.d/lightSync
|
|
|
|
COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/dockerfiles/continuousLogSync-service /etc/init.d/continuousLogSync
|
|
|
|
COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/dockerfiles/startup_script.sh /app/
|
2019-01-24 16:13:55 +00:00
|
|
|
COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/db/migrations/* /app/
|
2019-01-30 12:18:24 +00:00
|
|
|
COPY --from=builder /go/src/github.com/pressly/goose/cmd/goose/goose /app/goose
|
|
|
|
|
2019-01-21 10:17:39 +00:00
|
|
|
WORKDIR /app
|
2019-01-30 12:18:24 +00:00
|
|
|
RUN rc-status
|
2019-01-24 16:13:55 +00:00
|
|
|
CMD ["./goose"]
|