diff options
-rw-r--r-- | Dockerfile | 16 | ||||
-rw-r--r-- | Makefile | 110 | ||||
-rw-r--r-- | ethercalc.service | 23 |
3 files changed, 149 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3e7303b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM docker.io/node:lts-alpine + +MAINTAINER Hende, Botond <nettingman@gmail.com> +LABEL Description="Ethercalc server" + +ENV NODE_ENV=production +ENV OPENSHIFT_DATA_DIR=/srv/ethercalc + +RUN npm install --global ethercalc +RUN mkdir /srv/ethercalc && chown -R node:node /srv/ethercalc + +WORKDIR /srv/ethercalc +USER node +EXPOSE 8000/tcp + +CMD ["/usr/local/bin/ethercalc"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..47c116a --- /dev/null +++ b/Makefile @@ -0,0 +1,110 @@ +name = $(notdir $(realpath .)) +host = $(name) +pwd = $(realpath .) +run-args = -itd --name $(host) +run-cmd = + + +default: build + + +build: build-buildah + +build-docker: + docker build --squash -t $(name) $(pwd) + +build-buildah: + buildah bud --squash --layers -t $(name) $(pwd) + + +run: run-podman + +run-docker: stop-docker build-docker wait start-docker + +run-podman: stop-podman build-buildah wait start-podman + + +start: start-podman + +start-docker: + docker run --rm --cpus 1 $(run-args) $(name) $(run-cmd) + +start-podman: + podman run --rm $(run-args) $(name) $(run-cmd) + + +stop: stop-podman + +stop-docker: + -docker stop $(name) + +stop-podman: + -podman stop $(name) + + +kill: kill-podman + +kill-docker: + -docker kill $(name) + +kill-podman: + -podman kill $(name) + + +restart: restart-podman + +restart-docker: + -docker restart $(name) + +restart-podman: + -podman restart $(name) + + +wait: + sleep 1 + + +log: log-podman + +log-docker: + docker logs $(name) + +log-podman: + podman logs $(name) + + +clean: clean-podman + +clean-docker: kill-docker wait + -docker image prune --force + -docker container prune --force + +clean-podman: kill-podman wait + -buildah rm -a + -podman image prune + -podman container prune --force + + +shell: shell-podman + +shell-docker: console-docker + +shell-podman: console-podman + + +console: console-podman + +console-docker: + docker exec -it $(name) /bin/bash + +console-podman: + podman exec -it $(name) /bin/bash + + +status: status-podman + +status-docker: + docker exec -it $(name) /usr/bin/supervisorctl status + +status-podman: + podman exec -it $(name) /usr/bin/supervisorctl status diff --git a/ethercalc.service b/ethercalc.service new file mode 100644 index 0000000..85da327 --- /dev/null +++ b/ethercalc.service @@ -0,0 +1,23 @@ +[Unit] +Description = Ethercalc container +After = network.target +ConditionPathExists = /srv/ethercalc + +[Service] +Type = simple +ExecStartPre = -/usr/bin/podman stop ethercalc + +User = ethercalc +Group = ethercalc + +ExecStart = /usr/bin/podman run \ + --rm \ + --name ethercalc \ + --net host \ + -v /srv/ethercalc:/srv/ethercalc \ + localhost/ethercalc:latest + +Restart = always + +[Install] +WantedBy = default.target |