Add docker.
This commit is contained in:
parent
e96c39e3e0
commit
0d6621d389
6
.dockerignore
Normal file
6
.dockerignore
Normal file
@ -0,0 +1,6 @@
|
||||
**/.git
|
||||
target/
|
||||
docker/
|
||||
LICENSE
|
||||
readme/
|
||||
README.md
|
26
README.md
26
README.md
@ -4,4 +4,28 @@ This repository contains a slapdash tool to make visualizing the abstract syntax
|
||||
![Screenshot showing the interface to the org-mode abstract syntax tree investigation tool.](readme/screenshot.png?raw=true "Org-mode investigation tool interface")
|
||||
|
||||
## Running
|
||||
TODO
|
||||
Running in docker is the recommended way to run this. It creates a consistent working environment, without impacting (or requiring you to install) emacs, org-mode, or rust.
|
||||
### Docker
|
||||
First we need to build the docker container. On the first run, this will pull the emacs and org-mode source code so this build will take a while the first time. After that, subsequent builds should be fast because docker caches the layers.
|
||||
|
||||
```bash
|
||||
# from the root of this repository:
|
||||
make --directory=docker
|
||||
```
|
||||
|
||||
Next we need to launch the server:
|
||||
```bash
|
||||
docker run --rm --publish 127.0.0.1:3000:3000/tcp org-investigation
|
||||
```
|
||||
|
||||
This launches a server listening on port 3000, so pop open your browser to http://127.0.0.1:3000/ to access the web interface.
|
||||
### No docker
|
||||
You will need a fully functional rust setup with nightly installed (due to the use of exit_status_error). Then from the root of this repo you can launch the server by running:
|
||||
|
||||
```bash
|
||||
cargo run --release
|
||||
```
|
||||
|
||||
It will use your installed version of emacs and org-mode which may differ from what the docker users are using.
|
||||
|
||||
This launches a server listening on port 3000, so pop open your browser to http://127.0.0.1:3000/ to access the web interface.
|
||||
|
39
docker/Dockerfile
Normal file
39
docker/Dockerfile
Normal file
@ -0,0 +1,39 @@
|
||||
FROM alpine:3.17 AS build
|
||||
RUN apk add --no-cache build-base musl-dev git autoconf make texinfo gnutls-dev ncurses-dev gawk
|
||||
|
||||
|
||||
FROM build AS build-emacs
|
||||
RUN git clone --depth 1 --branch emacs-29.1 https://git.savannah.gnu.org/git/emacs.git /root/emacs
|
||||
WORKDIR /root/emacs
|
||||
RUN mkdir /root/dist
|
||||
RUN ./autogen.sh
|
||||
RUN ./configure --prefix /usr --without-x --without-sound
|
||||
RUN make
|
||||
RUN make DESTDIR="/root/dist" install
|
||||
|
||||
|
||||
FROM build AS build-org-mode
|
||||
COPY --from=build-emacs /root/dist/ /
|
||||
RUN mkdir /root/dist
|
||||
RUN mkdir /root/org-mode && git -C /root/org-mode init --initial-branch=main && git -C /root/org-mode remote add origin https://git.savannah.gnu.org/git/emacs/org-mode.git && git -C /root/org-mode fetch origin cc435cba71a99ee7b12676be3b6e1211a9cb7285 && git -C /root/org-mode checkout FETCH_HEAD
|
||||
WORKDIR /root/org-mode
|
||||
RUN make compile
|
||||
RUN make DESTDIR="/root/dist" install
|
||||
|
||||
|
||||
FROM rustlang/rust:nightly-alpine3.17 AS build-org-investigation
|
||||
RUN apk add --no-cache musl-dev
|
||||
RUN mkdir /root/org-investigation
|
||||
WORKDIR /root/org-investigation
|
||||
COPY . .
|
||||
RUN CARGO_TARGET_DIR=/target cargo build --release
|
||||
|
||||
|
||||
FROM alpine:3.17 AS run
|
||||
RUN apk add --no-cache ncurses gnutls
|
||||
COPY --from=build-emacs /root/dist/ /
|
||||
COPY --from=build-org-mode /root/dist/ /
|
||||
COPY --from=build-org-investigation /target/release/org_ownership_investigation /usr/bin/
|
||||
COPY static /opt/org-investigation/static
|
||||
WORKDIR /opt/org-investigation
|
||||
CMD ["/usr/bin/org_ownership_investigation"]
|
27
docker/Makefile
Normal file
27
docker/Makefile
Normal file
@ -0,0 +1,27 @@
|
||||
IMAGE_NAME:=org-investigation
|
||||
# REMOTE_REPO:=harbor.fizz.buzz/private
|
||||
|
||||
.PHONY: all
|
||||
all: build push
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
docker build -t $(IMAGE_NAME) -f Dockerfile ../
|
||||
|
||||
.PHONY: push
|
||||
push:
|
||||
ifdef REMOTE_REPO
|
||||
docker tag $(IMAGE_NAME) $(REMOTE_REPO)/$(IMAGE_NAME)
|
||||
docker push $(REMOTE_REPO)/$(IMAGE_NAME)
|
||||
else
|
||||
@echo "REMOTE_REPO not defined, not pushing to a remote repo."
|
||||
endif
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
docker rmi $(IMAGE_NAME)
|
||||
ifdef REMOTE_REPO
|
||||
docker rmi $(REMOTE_REPO)/$(IMAGE_NAME)
|
||||
else
|
||||
@echo "REMOTE_REPO not defined, not removing from remote repo."
|
||||
endif
|
Loading…
Reference in New Issue
Block a user