mirror of https://github.com/docker/docs.git
Convert the server and signer to use the alpine image and to remove apks after build
Signed-off-by: Ying Li <ying.li@docker.com>
This commit is contained in:
parent
b79d6d088b
commit
a021d16392
|
@ -7,7 +7,7 @@ server:
|
|||
- signer:notarysigner
|
||||
environment:
|
||||
- SERVICE_NAME=notary_server
|
||||
entrypoint: /bin/bash
|
||||
entrypoint: /usr/bin/env sh
|
||||
command: -c "./migrations/migrate.sh && notary-server -config=fixtures/server-config.json"
|
||||
signer:
|
||||
build: .
|
||||
|
@ -16,7 +16,7 @@ signer:
|
|||
- mysql
|
||||
environment:
|
||||
- SERVICE_NAME=notary_signer
|
||||
entrypoint: /bin/bash
|
||||
entrypoint: /usr/bin/env sh
|
||||
command: -c "./migrations/migrate.sh && notary-signer -config=fixtures/signer-config.json"
|
||||
mysql:
|
||||
volumes:
|
||||
|
|
|
@ -10,7 +10,7 @@ server:
|
|||
ports:
|
||||
- "8080"
|
||||
- "4443:4443"
|
||||
entrypoint: /bin/bash
|
||||
entrypoint: /usr/bin/env sh
|
||||
command: -c "./migrations/migrate.sh && notary-server -config=fixtures/server-config.json"
|
||||
signer:
|
||||
build: .
|
||||
|
@ -19,7 +19,7 @@ signer:
|
|||
- mysql
|
||||
environment:
|
||||
- SERVICE_NAME=notary_signer
|
||||
entrypoint: /bin/bash
|
||||
entrypoint: /usr/bin/env sh
|
||||
command: -c "./migrations/migrate.sh && notary-signer -config=fixtures/signer-config.json"
|
||||
mysql:
|
||||
volumes:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# When run in the docker containers, the working directory
|
||||
# is the root of the repo.
|
||||
|
@ -10,8 +10,8 @@ case $SERVICE_NAME in
|
|||
# have to poll for DB to come up
|
||||
until migrate -path=migrations/server/mysql -url="mysql://server@tcp(mysql:3306)/notaryserver" version > /dev/null
|
||||
do
|
||||
((iter++))
|
||||
if (( iter > 30 )); then
|
||||
iter=$(( iter+1 ))
|
||||
if [[ $iter -gt 30 ]]; then
|
||||
echo "notaryserver database failed to come up within 30 seconds"
|
||||
exit 1;
|
||||
fi
|
||||
|
@ -35,8 +35,8 @@ case $SERVICE_NAME in
|
|||
# have to poll for DB to come up
|
||||
until migrate -path=migrations/signer/mysql -url="mysql://signer@tcp(mysql:3306)/notarysigner" version > /dev/null
|
||||
do
|
||||
((iter++))
|
||||
if (( iter > 30 )); then
|
||||
iter=$(( iter+1 ))
|
||||
if [[ $iter -gt 30 ]]; then
|
||||
echo "notarysigner database failed to come up within 30 seconds"
|
||||
exit 1;
|
||||
fi
|
||||
|
@ -44,7 +44,7 @@ case $SERVICE_NAME in
|
|||
sleep 1
|
||||
done
|
||||
pre=$(migrate -path=migrations/signer/mysql -url="mysql://signer@tcp(mysql:3306)/notarysigner" version)
|
||||
if migrate -path=migrations/signer/mysql -url="mysql://signer@tcp(mysql:3306)/notarysigner" up ; then
|
||||
if migrate -path=migrations/signer/mysql -url="mysql://signer@tcp(mysql:3306)/notarysigner" up ; then
|
||||
post=$(migrate -path=migrations/signer/mysql -url="mysql://signer@tcp(mysql:3306)/notarysigner" version)
|
||||
if [ "$pre" != "$post" ]; then
|
||||
echo "notarysigner database migrated to latest version"
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
FROM golang:1.6.0
|
||||
FROM golang:1.6.0-alpine
|
||||
MAINTAINER David Lawrence "david.lawrence@docker.com"
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libltdl-dev \
|
||||
--no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
EXPOSE 4443
|
||||
RUN apk add --update git gcc libc-dev && rm -rf /var/cache/apk/*
|
||||
|
||||
# Install DB migration tool
|
||||
RUN go get github.com/mattes/migrate
|
||||
|
@ -16,13 +11,15 @@ ENV NOTARYPKG github.com/docker/notary
|
|||
# Copy the local repo to the expected go path
|
||||
COPY . /go/src/github.com/docker/notary
|
||||
|
||||
WORKDIR /go/src/${NOTARYPKG}
|
||||
WORKDIR /go/src/github.com/docker/notary
|
||||
|
||||
EXPOSE 4443
|
||||
|
||||
# Install notary-server
|
||||
RUN go install \
|
||||
-tags pkcs11 \
|
||||
-ldflags "-w -X ${NOTARYPKG}/version.GitCommit=`git rev-parse --short HEAD` -X ${NOTARYPKG}/version.NotaryVersion=`cat NOTARY_VERSION`" \
|
||||
${NOTARYPKG}/cmd/notary-server
|
||||
${NOTARYPKG}/cmd/notary-server && apk del git gcc libc-dev
|
||||
|
||||
ENTRYPOINT [ "notary-server" ]
|
||||
CMD [ "-config=fixtures/server-config-local.json" ]
|
||||
|
|
|
@ -1,30 +1,28 @@
|
|||
FROM golang:1.6.0
|
||||
FROM golang:1.6.0-alpine
|
||||
MAINTAINER David Lawrence "david.lawrence@docker.com"
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libltdl-dev \
|
||||
--no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
EXPOSE 4444
|
||||
RUN apk add --update git gcc libc-dev && rm -rf /var/cache/apk/*
|
||||
|
||||
# Install DB migration tool
|
||||
RUN go get github.com/mattes/migrate
|
||||
|
||||
ENV NOTARYPKG github.com/docker/notary
|
||||
ENV NOTARY_SIGNER_DEFAULT_ALIAS="timestamp_1"
|
||||
ENV NOTARY_SIGNER_TIMESTAMP_1="testpassword"
|
||||
|
||||
# Copy the local repo to the expected go path
|
||||
COPY . /go/src/github.com/docker/notary
|
||||
|
||||
WORKDIR /go/src/${NOTARYPKG}
|
||||
WORKDIR /go/src/github.com/docker/notary
|
||||
|
||||
ENV NOTARY_SIGNER_DEFAULT_ALIAS="timestamp_1"
|
||||
ENV NOTARY_SIGNER_TIMESTAMP_1="testpassword"
|
||||
|
||||
EXPOSE 4444
|
||||
|
||||
# Install notary-signer
|
||||
RUN go install \
|
||||
-tags pkcs11 \
|
||||
-ldflags "-w -X ${NOTARYPKG}/version.GitCommit=`git rev-parse --short HEAD` -X ${NOTARYPKG}/version.NotaryVersion=`cat NOTARY_VERSION`" \
|
||||
${NOTARYPKG}/cmd/notary-signer
|
||||
${NOTARYPKG}/cmd/notary-signer && apk del git gcc libc-dev
|
||||
|
||||
ENTRYPOINT [ "notary-signer" ]
|
||||
CMD [ "-config=fixtures/signer-config-local.json" ]
|
||||
|
|
Loading…
Reference in New Issue