Added Dockerfile
authorAdam Dullage <redacted>
Wed, 11 Aug 2021 20:06:43 +0000 (21:06 +0100)
committerAdam Dullage <redacted>
Wed, 11 Aug 2021 20:06:43 +0000 (21:06 +0100)
.dockerignore [new file with mode: 0644]
Dockerfile [new file with mode: 0644]

diff --git a/.dockerignore b/.dockerignore
new file mode 100644 (file)
index 0000000..0ed27f0
--- /dev/null
@@ -0,0 +1,10 @@
+# Ignore everything
+**
+
+# Include the following
+!LICENSE
+!Pipfile
+!Pipfile.lock
+!package.json
+!package-lock.json
+!flatnotes/**
diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..3dd3ab2
--- /dev/null
@@ -0,0 +1,39 @@
+FROM python:3.8-alpine3.14
+
+ARG USER=flatnotes
+ARG UID=1000
+ARG GID=1000
+ARG APP_DIR=/app
+
+RUN addgroup \
+    --gid $GID \
+    ${USER} \
+ && adduser \
+    --disabled-password \
+    --gecos "" \
+    --home ${APP_DIR} \
+    --ingroup ${USER} \
+    --uid ${UID} \
+    ${USER}
+
+RUN apk add --update-cache \
+    libc-dev \
+    gcc \
+    npm \
+ && rm -rf /var/cache/apk/* \
+ && pip install pipenv
+
+USER ${UID}
+
+WORKDIR ${APP_DIR}
+
+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" ]
git clone https://git.99rst.org/PROJECT