catalogue/docker/catalogue/Dockerfile
FROM golang:1.7 COPY . /go/src/github.com/microservices-demo/catalogue WORKDIR /go/src/github.com/microservices-demo/catalogue RUN go get -u github.com/FiloSottile/gvt RUN gvt restore && \ CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app github.com/microservices-demo/catalogue/cmd/cataloguesvc FROM alpine:3.4 #참조: http://wiki.thesanse.com/pages/viewpage.action?pageId=7340491 ENV SERVICE_USER=myuser \ SERVICE_UID=10001 \ SERVICE_GROUP=mygroup \ SERVICE_GID=10001 RUN addgroup -g ${SERVICE_GID} ${SERVICE_GROUP} && \ adduser -g "${SERVICE_NAME} user" -D -H -G ${SERVICE_GROUP} -s /sbin/nologin -u ${SERVICE_UID} ${SERVICE_USER} && \ apk add --update libcap WORKDIR / COPY --from=0 /app /app #참조: http://wiki.thesanse.com/pages/viewpage.action?pageId=7340491 COPY images/ /images/ RUN chmod +x /app && \ chown -R ${SERVICE_USER}:${SERVICE_GROUP} /app /images && \ setcap 'cap_net_bind_service=+ep' /app USER ${SERVICE_USER} ARG BUILD_DATE ARG BUILD_VERSION ARG COMMIT LABEL org.label-schema.vendor="Weaveworks" \ org.label-schema.build-date="${BUILD_DATE}" \ org.label-schema.version="${BUILD_VERSION}" \ org.label-schema.name="Socks Shop: Catalogue" \ org.label-schema.description="REST API for Catalogue service" \ org.label-schema.url="https://github.com/microservices-demo/catalogue" \ org.label-schema.vcs-url="github.com:microservices-demo/catalogue.git" \ org.label-schema.vcs-ref="${COMMIT}" \ org.label-schema.schema-version="1.0" CMD ["/app", "-port=80"] EXPOSE 80
catalogue/docker/catalogue-db/Dockerfile
FROM mysql:5.7 # ENV MYSQL_ROOT_PASSWORD DEFAULT_PASS # ENV MYSQL_ALLOW_EMPTY_PASSWORD=true # ENV MYSQL_DATABASE=socksdb COPY ./data/dump.sql /docker-entrypoint-initdb.d/
catalogue/docker-compose.yml
version: '2' services: catalogue: build: context: . dockerfile: ./docker/catalogue/Dockerfile image: weaveworksdemos/catalogue hostname: catalogue restart: always cap_drop: - all cap_add: - NET_BIND_SERVICE read_only: true environment: - reschedule=on-node-failure ports: - "8080:80" catalogue-db: build: context: ./docker/catalogue-db/ image: weaveworksdemos/catalogue-db hostname: catalogue-db restart: always environment: - reschedule=on-node-failure - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} - MYSQL_ALLOW_EMPTY_PASSWORD=true - MYSQL_DATABASE=socksdb
catalogue/docker-compose-zipkin.yml
version: '2' services: catalogue: build: context: . dockerfile: ./docker/catalogue/Dockerfile image: weaveworksdemos/catalogue hostname: catalogue restart: always cap_drop: - all cap_add: - NET_BIND_SERVICE read_only: true environment: - ZIPKIN=http://zipkin:9411/api/v1/spans - reschedule=on-node-failure ports: - "8080:80" catalogue-db: build: context: ./docker/catalogue-db/ image: weaveworksdemos/catalogue-db hostname: catalogue-db restart: always environment: - reschedule=on-node-failure - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} - MYSQL_ALLOW_EMPTY_PASSWORD=true - MYSQL_DATABASE=socksdb zipkin: image: openzipkin/zipkin hostname: zipkin restart: always cap_drop: - all cap_add: - CHOWN - SETGID - SETUID read_only: true tmpfs: - /tmp:rw,noexec,nosuid environment: - reschedule=on-node-failure ports: - "9411:9411" zipkinseed: image: alpine command: /bin/sh -c 'sleep 10 ; wget http://catalogue/health ; wget http://catalogue/catalogue ; wget http://catalogue/catalogue/size ; wget http://catalogue/tags'
0 Comments