From: Adam Dullage Date: Wed, 11 Aug 2021 20:06:43 +0000 (+0100) Subject: Added Dockerfile X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=95be2d0a0313c1359bb20fc5b57f9111f04f1185;p=flatnotes.git Added Dockerfile --- diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0ed27f0 --- /dev/null +++ b/.dockerignore @@ -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 index 0000000..3dd3ab2 --- /dev/null +++ b/Dockerfile @@ -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" ]