Skip to content

Commit

Permalink
add dockerfile plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
yangziwen committed Aug 30, 2018
1 parent 00c91f8 commit 4e87c36
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ ENV LOCAL_PORT 21
ENV PASSIVE_ADDRESS 127.0.0.1
ENV PASSIVE_PORTS 40000-40060
COPY target/zy-ftp.jar zy-ftp.jar
CMD ["sh", "-c", "java -jar zy-ftp.jar -c server.config -l zy-ftp.log --passive-address $PASSIVE_ADDRESS --passive-ports $PASSIVE_PORTS --local-ip $LOCAL_IP --local-port $LOCAL_PORT"]
EXPOSE 21
CMD ["sh", "-c", "java -jar zy-ftp.jar -c server.config -l zy-ftp.log --passive-address $PASSIVE_ADDRESS --passive-ports $PASSIVE_PORTS --local-ip $LOCAL_IP --local-port $LOCAL_PORT"]
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
1. 打包代码:`mvn package` or `gradle build`
2. 启动服务:`java -jar zy-ftp.jar -c ${config_file_path}`
* 基于docker运行
1. 打包代码:`mvn package` or `gradle build`
2. 制作镜像:`docker build -t zy-ftp:0.0.1 .`
3. 启动容器:
1. 制作镜像:`mvn package dockerfile:build`
2. 启动容器:
```
docker run -d \
-v ${your_config_file}:/zy-ftp/server.config \
Expand Down
12 changes: 11 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>io.github.yangziwen</groupId>
<artifactId>zy-ftp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
<packaging>jar</packaging>

<name>zy-ftp</name>
Expand Down Expand Up @@ -127,6 +127,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<repository>${project.name}</repository>
<tag>${project.version}</tag>
<skipPush>true</skipPush>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@ public FtpResponse execute(FtpSession session, FtpRequest request) {

FtpResponse response = createResponse(FtpReply.REPLY_150, request);
response.setFlushedPromise(session.newChannelPromise().addListener(f -> {
doReceiveFileContent(request, file);
doReceiveFileContent(session, request, file);
}));
return response;
}

private void doReceiveFileContent(FtpRequest request, FileView file) {
private void doReceiveFileContent(FtpSession session, FtpRequest request, FileView file) {
request.getSession().getLatestDataConnection().getCloseFuture().addListener(f -> {
session.decreaseUploadConnections();
FtpServerHandler.sendResponse(createResponse(FtpReply.REPLY_226, request), request.getSession().getContext());
});
}
Expand Down

0 comments on commit 4e87c36

Please sign in to comment.