<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>proxy-client &#8211; Lhy&#039;s blog</title>
	<atom:link href="https://blog.lhyshome.com/tag/proxy-client/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.lhyshome.com</link>
	<description>welcome</description>
	<lastBuildDate>Mon, 30 Dec 2024 03:05:37 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">219834889</site>	<item>
		<title>docker创建proxy-client镜像（设置 -e 参数配置）</title>
		<link>https://blog.lhyshome.com/2024/12/30/257/</link>
					<comments>https://blog.lhyshome.com/2024/12/30/257/#respond</comments>
		
		<dc:creator><![CDATA[lhy]]></dc:creator>
		<pubDate>Mon, 30 Dec 2024 03:04:33 +0000</pubDate>
				<category><![CDATA[java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[小技巧]]></category>
		<category><![CDATA[脚本]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[harbor]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[proxy-client]]></category>
		<category><![CDATA[内网穿透]]></category>
		<guid isPermaLink="false">https://blog.lhyshome.com/?p=257</guid>

					<description><![CDATA[文件夹目录 dockerFile ep.sh config.template docker构建及上传 进入pr… <span class="read-more"><a href="https://blog.lhyshome.com/2024/12/30/257/">Read More &#187;</a></span>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">文件夹目录</h2>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="321" height="392" src="https://blog.lhyshome.com/wp-content/uploads/2024/12/image-2.png" alt="" class="wp-image-259" srcset="https://blog.lhyshome.com/wp-content/uploads/2024/12/image-2.png 321w, https://blog.lhyshome.com/wp-content/uploads/2024/12/image-2-246x300.png 246w" sizes="(max-width: 321px) 100vw, 321px" /></figure>



<h2 class="wp-block-heading">dockerFile</h2>



<pre class="wp-block-code"><code>FROM {harbor}/test/openjdk:8-jre
LABEL authors="lhyshome_pc"
ENV TZ=Asia/Shanghai
ADD ./proxy-client /proxy-client
ADD ./ep.sh /ep.sh
RUN apt-get update &amp;&amp; apt-get install -y procps
RUN apt-get update &amp;&amp; apt-get install -y dos2unix
RUN dos2unix /ep.sh &amp;&amp; chmod +x /ep.sh
ENTRYPOINT &#91;"/ep.sh"]</code></pre>



<h2 class="wp-block-heading">ep.sh </h2>



<pre class="wp-block-code"><code>#!/bin/bash

echo "entrypoint.sh start"
# 定义目标配置文件路径
CONFIG_FILE=proxy-client/conf/config.properties

# 替换占位符为环境变量的值
sed -e "s|{{CLIENT_KEY}}|${CLIENT_KEY:-CLIENT_KEY}|g" \
    -e "s|{{SERVER_HOST}}|${SERVER_HOST:-127.0.0.1}|g" \
    -e "s|{{SERVER_PORT}}|${SERVER_PORT:-80}|g" \
    proxy-client/conf/config.template > $CONFIG_FILE

echo "Generated config file:"
cat $CONFIG_FILE

# 启动主程序（根据需要替换为实际启动命令）
exec "proxy-client/bin/startup.sh"</code></pre>



<h2 class="wp-block-heading">config.template</h2>



<pre class="wp-block-code"><code>client.key={{CLIENT_KEY}}
server.host={{SERVER_HOST}}
server.port={{SERVER_PORT}}</code></pre>



<h2 class="wp-block-heading">docker构建及上传</h2>



<p>进入proxy-client的上级目录</p>



<pre class="wp-block-code"><code>docker build -t {harbor}/test/proxy-client:v1.0.0 ./
docker push {harbor}/test/proxy-client:v1.0.0
docker image rm {harbor}/test/proxy-client:v1.0.0</code></pre>



<h2 class="wp-block-heading">docker部署命令</h2>



<p>docker run -e CLIENT_KEY=xxxxx -e SERVER_HOST=xxx.xxx.xxx.xxx -e SERVER_PORT=xxxx &#8211;name proxy-client &#8211;privileged=true &#8211;restart=always -d {harbor}/test/proxy-client:v1.0.0</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.lhyshome.com/2024/12/30/257/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">257</post-id>	</item>
	</channel>
</rss>
