Docker Deployment
authorAdam Dullage <redacted>
Thu, 12 Aug 2021 07:23:04 +0000 (08:23 +0100)
committerAdam Dullage <redacted>
Thu, 12 Aug 2021 07:23:04 +0000 (08:23 +0100)
.gitignore
Dockerfile
README.md
docker-compose.yaml [new file with mode: 0644]

index 619b7c7d26d93ba256d94f9b6ed34e7d2253c791..53dadd98607aac3ab3f5550d769507a34d7969c7 100644 (file)
@@ -247,3 +247,4 @@ dist
 
 # Custom
 .vscode/
+data/
index 45acbe1d0172e7c579f66b79c5d97409398ffb50..28859e30909af38297f040016e8250cbc6be60a9 100644 (file)
@@ -3,8 +3,12 @@ FROM python:3.8-alpine3.14
 ARG USER=flatnotes
 ARG UID=1000
 ARG GID=1000
+
 ARG APP_DIR=/app
 
+ARG DATA_DIR=${APP_DIR}/data
+ENV FLATNOTES_PATH=${DATA_DIR}
+
 RUN addgroup \
     --gid $GID \
     ${USER} \
@@ -16,6 +20,8 @@ RUN addgroup \
     --uid ${UID} \
     ${USER}
 
+RUN mkdir ${DATA_DIR} && chown ${UID}:${GID} ${DATA_DIR}
+
 RUN apk add --update-cache \
     libc-dev \
     gcc \
@@ -24,20 +30,13 @@ RUN apk add --update-cache \
  && pip install pipenv
 
 USER ${UID}
-
 WORKDIR ${APP_DIR}
 
-RUN mkdir data
-
-ENV FLATNOTES_PATH=${APP_DIR}/data
-
 COPY --chown=${UID}:${GID} LICENSE Pipfile Pipfile.lock package.json package-lock.json ./
-
 RUN pipenv install --system --deploy --ignore-pipfile \
  && npm ci
 
 COPY --chown=${UID}:${GID} flatnotes ./flatnotes
-
 RUN npm run build
 
 ENTRYPOINT [ "python", "-m", "uvicorn", "main:app", "--app-dir", "flatnotes", "--host", "0.0.0.0", "--port", "80" ]
index 8600e511196f18412d4ce173e581211abc46fcf1..6335e1ad4473b6be2dc365c6d2d345f7a5619923 100644 (file)
--- a/README.md
+++ b/README.md
@@ -32,7 +32,7 @@ This is what flatnotes aims to achieve.
 * [ ] Proof of Concept - Stage 2
   * [x] View Note Content
   * [x] Edit Note Content
-  * [ ] Docker Deployment
+  * [x] Docker Deployment
   * [ ] Password Authentication
 * [ ] Proof of Concept - Stage 3
   * [ ] Image Embedding
diff --git a/docker-compose.yaml b/docker-compose.yaml
new file mode 100644 (file)
index 0000000..c176655
--- /dev/null
@@ -0,0 +1,12 @@
+version: "3"
+
+services:
+  flatnotes:
+    container_name: flatnotes
+    image: dullage/flatnotes:latest
+    build: .
+    volumes:
+      - "./data:/data"
+    ports:
+      - "80:80"
+    restart: unless-stopped
git clone https://git.99rst.org/PROJECT