: 1
 Add Dockerfile

 4 files changed, 68 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~edwardloveall/scribe/patches/25736/mbox | git am -3
Learn more about email & git

[PATCH] Add Dockerfile Export this patch

From: tnp <tnp@tnp.arpa>

 .dockerignore            |  3 +++
 Dockerfile               | 41 ++++++++++++++++++++++++++++++++++++++++
 README.md                | 20 ++++++++++++++++++++
 script/docker_entrypoint |  4 ++++
 4 files changed, 68 insertions(+)
 create mode 100644 .dockerignore
 create mode 100644 Dockerfile
 create mode 100755 script/docker_entrypoint

diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..18457d4
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,3 @@
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..1af6ec5
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,41 @@
FROM node:alpine as node_build
WORKDIR /tmp_build

COPY package.json .
COPY yarn.lock .
RUN yarn install --no-progress --frozen-lockfile

COPY webpack.mix.js .
COPY src ./src
RUN yarn prod

FROM crystallang/crystal:1.0.0-alpine as lucky_build
RUN apk add yaml-static
WORKDIR /tmp_build
COPY shard.* ./
RUN  shards install --production
COPY . .
COPY --from=node_build /tmp_build/public/mix-manifest.json public/mix-manifest.json
RUN crystal build --static src/start_server.cr
RUN crystal build --static tasks.cr -o run_task

FROM alpine


RUN addgroup -g ${PGID} -S lucky && \
    adduser -u ${PUID} -S lucky -G lucky
WORKDIR /home/lucky/app

COPY --chown=lucky:lucky --from=node_build /tmp_build/public public
COPY --chown=lucky:lucky --from=lucky_build /tmp_build/start_server start_server
COPY --chown=lucky:lucky --from=lucky_build /tmp_build/run_task run_task
COPY --chown=lucky:lucky ./script/docker_entrypoint ./

RUN mkdir ./config
RUN chown -R lucky /home/lucky
USER lucky

CMD ["/home/lucky/app/docker_entrypoint"]
diff --git a/README.md b/README.md
index 0a4460f..d336518 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,26 @@ One thing to note is that this app doesn't currently use a database. Any instruc

Hopefully a more comprehensive guide will be written at some point, but for now feel free to reach out if you have any questions. My contact info can be found on [my website](https://edwardloveall.com).

### Docker

A Dockerfile is included to build and run your own OCI images. To build:

$ docker build [--build-arg PUID=1000] [--build-arg PGID=1000] -t scribe:latest -f ./Dockerfile .

To run (generating a base config from environment variables):

$ docker run -it --rm -p 8080:8080 -e SCRIBE_PORT=8080 -e SCRIBE_HOST= -e SCRIBE_DB=postgres://does@not/matter scribe:latest

To run with mounted config from local fs:

$ docker run -it --rm -v `pwd`/config/watch.yml:/app/config/watch.yml -p 8080:8080 scribe:latest

## Contributing

1. [Install required dependencies](https://luckyframework.org/guides/getting-started/installing#install-required-dependencies)
diff --git a/script/docker_entrypoint b/script/docker_entrypoint
new file mode 100755
index 0000000..718a309
--- /dev/null
+++ b/script/docker_entrypoint
@@ -0,0 +1,4 @@

echo -e "port: ${SCRIBE_PORT}\nhost: ${SCRIBE_HOST}\ndatabase: ${SCRIBE_DB}" > ./config/watch.yml
Thanks for your patch. This has been merged.

So anyone else is aware, we talked offline about how I'm not a Docker 
user so this will likely be unsupported by me. However, there are some 
valid use cases like deploying where Docker can make sense. If Docker 
breaks in some way, I likely won't notice so it may be some time before 
they it's fixed.