From: Adam Dullage Date: Thu, 12 Aug 2021 07:23:04 +0000 (+0100) Subject: Docker Deployment X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=796e634df7fb4468827989c6dd145c2cebec55be;p=flatnotes.git Docker Deployment --- diff --git a/.gitignore b/.gitignore index 619b7c7..53dadd9 100644 --- a/.gitignore +++ b/.gitignore @@ -247,3 +247,4 @@ dist # Custom .vscode/ +data/ diff --git a/Dockerfile b/Dockerfile index 45acbe1..28859e3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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" ] diff --git a/README.md b/README.md index 8600e51..6335e1a 100644 --- 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 index 0000000..c176655 --- /dev/null +++ b/docker-compose.yaml @@ -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