我根据https://github.com/rodolpheche/wiremock-dockerDockerfile
中的示例创建了这个并将其复制到/my/project/wiremock目录中:
FROM openjdk:8-jre-alpine
ENV WIREMOCK_VERSION 2.27.1
RUN apk add --update openssl
# fix "No Server ALPNProcessors" when using https
RUN apk add --update libc6-compat
RUN ln -s /lib/libc.musl-x86_64.so.1 /lib/ld-linux-x86-64.so.2
# grab su-exec for easy step-down from root
# and bash
RUN apk add --no-cache 'su-exec>=0.2' bash
# grab wiremock standalone jar
RUN mkdir -p /var/wiremock/lib/ \
&& wget https://repo1.maven.org/maven2/com/github/tomakehurst/wiremock-jre8-
standalone/$WIREMOCK_VERSION/wiremock-jre8-standalone-$WIREMOCK_VERSION.jar \
-O /var/wiremock/lib/wiremock-jre8-standalone.jar
WORKDIR /home/wiremock
EXPOSE 7070 7443
CMD java $JAVA_OPTS -cp /var/wiremock/lib/*:/var/wiremock/extensions/*
com.github.tomakehurst.wiremock.standalone.WireMockServerRunner
然后我在/my/project/目录中创建了以下docker-compose.yml
文件
version: '3'
services:
wiremock:
image: rodolpheche/wiremock:latest
container_name: miplata-wiremock-local
build: ./wiremock/.
ports:
- "7070:8080"
- "7443:8443"
volumes:
- ./wiremock/stubs:/home/wiremock
/my/project/ wiremock /stubs中的子目录是映射和__files。
当我执行docker-compose up
时,docker 容器可以工作,我可以提出一些可以正常工作的请求。但我的问题是,存根目录中的更改不会自动刷新,然后每次创建新的wiremock存根或更新现有存根时我都需要重新启动容器。
你知道我做错了什么吗?在不重新启动容器的情况下继续工作会很好。
谢谢!!!!