-
Notifications
You must be signed in to change notification settings - Fork 433
Add Docker build files #607
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| FROM mysql | ||
|
|
||
| ENV MYSQL_PASSWORD=zaphod \ | ||
| MYSQL_USER=test \ | ||
| MYSQL_DATABASE=test \ | ||
| MYSQL_RANDOM_ROOT_PASSWORD=yes | ||
|
|
||
| ADD storage/mysql/storage.sql /docker-entrypoint-initdb.d/storage.sql | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| FROM golang | ||
|
|
||
| ENV DB_USER=test \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be better to use ARG rather than ENV, so that these values can be overridden when building the image. I'm ok with ENV though.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ENV allows the arguments to be overridden at runtime which might be even more flexible than fixing them at build time.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The documentation suggests using both, by declaring an ARG first and then using its value to initialize the ENV. I'm fine with leaving it as it is though, just thought I'd highlight this option. |
||
| DB_PASSWORD=zaphod \ | ||
| DB_DATABASE=test \ | ||
| DB_HOST=127.0.0.0:3306 | ||
|
|
||
| ENV HOST=0.0.0.0 \ | ||
| RPC_PORT=8090 \ | ||
| HTTP_PORT=8091 | ||
|
|
||
| ENV DUMP_METRICS 0s | ||
|
|
||
| ADD . /go/src/github.com/google/trillian | ||
| WORKDIR /go/src/github.com/google/trillian | ||
|
|
||
| RUN go get -v ./server/trillian_log_server | ||
|
|
||
| ENTRYPOINT /go/bin/trillian_log_server \ | ||
| --mysql_uri="${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST})/${DB_DATABASE}" \ | ||
| --rpc_endpoint="$HOST:$RPC_PORT" \ | ||
| --http_endpoint="$HOST:$HTTP_PORT" \ | ||
| --dump_metrics_interval="$DUMP_METRICS" \ | ||
| --alsologtostderr | ||
|
|
||
| EXPOSE $RPC_PORT | ||
| EXPOSE $HTTP_PORT | ||
|
|
||
| HEALTHCHECK --interval=5m --timeout=3s \ | ||
| CMD curl -f http://localhost:$HTTP_PORT/debug/vars || exit 1 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| FROM golang | ||
|
|
||
| ENV DB_USER=test \ | ||
| DB_PASSWORD=zaphod \ | ||
| DB_DATABASE=test \ | ||
| DB_HOST=127.0.0.0:3306 | ||
|
|
||
| ENV HOST=0.0.0.0 \ | ||
| HTTP_PORT=8091 | ||
|
|
||
| ENV SEQUENCER_GUARD_WINDOW=0s \ | ||
| DUMP_METRICS=0s \ | ||
| FORCE_MASTER=true | ||
|
|
||
|
|
||
| ADD . /go/src/github.com/google/trillian | ||
| WORKDIR /go/src/github.com/google/trillian | ||
|
|
||
| RUN go get ./server/trillian_log_signer | ||
|
|
||
| # Run the outyet command by default when the container starts. | ||
| ENTRYPOINT /go/bin/trillian_log_signer \ | ||
| --mysql_uri="${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST})/${DB_DATABASE}" \ | ||
| --http_endpoint="$HOST:$HTTP_PORT" \ | ||
| --dump_metrics_interval="$DUMP_METRICS" \ | ||
| --sequencer_guard_window="$SEQUENCER_GUARD_WINDOW" \ | ||
| --force_master="$FORCE_MASTER" \ | ||
| --alsologtostderr | ||
|
|
||
| EXPOSE $HTTP_PORT | ||
|
|
||
| HEALTHCHECK --interval=5m --timeout=3s \ | ||
| CMD curl -f http://localhost:$HTTP_PORT/debug/vars || exit 1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| FROM golang | ||
|
|
||
| ENV DB_USER=test \ | ||
| DB_PASSWORD=zaphod \ | ||
| DB_DATABASE=test \ | ||
| DB_HOST=127.0.0.0:3306 | ||
|
|
||
| ENV HOST=0.0.0.0 \ | ||
| RPC_PORT=8090 \ | ||
| HTTP_PORT=8091 | ||
|
|
||
| ADD . /go/src/github.com/google/trillian | ||
| WORKDIR /go/src/github.com/google/trillian | ||
|
|
||
| RUN go get ./server/vmap/trillian_map_server | ||
|
|
||
| ENTRYPOINT /go/bin/trillian_map_server \ | ||
| --mysql_uri="${DB_USER}:${DB_PASSWORD}@tcp(${DB_HOST})/${DB_DATABASE}" \ | ||
| --rpc_endpoint="$HOST:$RPC_PORT" \ | ||
| --http_endpoint="$HOST:$HTTP_PORT" \ | ||
| --alsologtostderr | ||
|
|
||
| EXPOSE $HTTP_PORT | ||
|
|
||
| HEALTHCHECK --interval=5m --timeout=3s \ | ||
| CMD curl -f http://localhost:$HTTP_PORT/debug/vars || exit 1 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this Dockerfile for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the Docker equivalent of
./script/resetdbsince this particular mysql image runs all the sql scripts in/docker-entrypoint-initdb.dwhen it's being initialized.