diff --git a/Dockerfile b/Dockerfile index 3d2836d..1c1d4af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,10 +19,12 @@ RUN mkdir -p pkg/usr/bin RUN curl -L ${download_url}/${etcd_version}/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz -o tmp/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz RUN tar xzvf tmp/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz -C tmp/etcd/ --strip-components=1 RUN cp tmp/etcd/etcd* pkg/usr/bin/ +COPY etcd.service pkg/etc/systemd/system/ # create deb package RUN fpm -s dir -t deb -n etcd -v ${etcd_version} --iteration ${pkg_revision} -a ${arch} \ --url https://etcd.io --maintainer "84codes " \ --description "A distributed, reliable key-value store" \ + --deb-systemd etcd.service \ --license "Apache 2.0" --chdir pkg . # ARM64 @@ -33,10 +35,12 @@ RUN rm -rf pkg/usr/bin/* RUN curl -L ${download_url}/${etcd_version}/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz -o tmp/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz RUN tar xzvf tmp/etcd-${etcd_version}-${TARGETOS}-${arch}.tar.gz -C tmp/etcd/ --strip-components=1 RUN cp tmp/etcd/etcd* pkg/usr/bin/ +COPY etcd.service pkg/etc/systemd/system/ # create deb package RUN fpm -s dir -t deb -n etcd -v ${etcd_version} --iteration ${pkg_revision} -a ${arch} \ --url https://etcd.io --maintainer "84codes " \ --description "A distributed, reliable key-value store" \ + --deb-systemd etcd.service \ --license "Apache 2.0" --chdir pkg . # put .deb files in a scratch image for exporting diff --git a/etcd.service b/etcd.service new file mode 100644 index 0000000..e915243 --- /dev/null +++ b/etcd.service @@ -0,0 +1,17 @@ +[Unit] +Description=etcd key-value store +Documentation=https://github.com/etcd-io/etcd +After=network-online.target local-fs.target remote-fs.target time-sync.target +Wants=network-online.target local-fs.target remote-fs.target time-sync.target + +[Service] +Type=notify +Environment=ETCD_DATA_DIR=/var/lib/etcd +Environment=ETCD_NAME=%m +ExecStart=/usr/bin/etcd --config-file /etc/etcd/etcd.conf.yml +Restart=always +RestartSec=10s +LimitNOFILE=40000 + +[Install] +WantedBy=multi-user.target \ No newline at end of file