Dre*_*ejc 11 workflow yaml github github-actions
我有以下 GitHub 工作流程来构建我的项目
name: build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn clean compile test
Run Code Online (Sandbox Code Playgroud)
构建工作得很好。但是,项目 JUnit 测试要求 localhost 服务器正在侦听端口 4444 ...并且我收到以下错误:
连接被拒绝:localhost/127.0.0.1:4444
服务器在每个 JUnit 测试之前启动,并且是测试套件的一部分。
如何告诉 docker 容器此端口上允许网络连接?或者默认情况下是否有任何开放端口?
我分享我的解决方案。希望它会有所帮助。
FROM golang:1.15.2-alpine
# Setup you server
# This container exposes port 8080 to the outside world
EXPOSE 8080
# Run the executable
CMD ["./main"]
Run Code Online (Sandbox Code Playgroud)
main-server:
build: ./
container_name: main-server
image: artofimagination/main-server
ports:
- 8080:8080
Run Code Online (Sandbox Code Playgroud)
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Start test server
run: docker-compose up -d main-server
- name: Run functional test
run: pip3 install -r test/requirements.txt && pytest -v test
Run Code Online (Sandbox Code Playgroud)
祝你好运,我希望这会有所帮助。
| 归档时间: |
|
| 查看次数: |
2215 次 |
| 最近记录: |