diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6478c1a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,26 @@ +# commonly found +**/.git +**/.idea +**/.DS_Store +**/.vscode +**/.devcontainer + +**/dist +**/.gitignore +**/Dockerfile +**/.dockerignore + +# found in python and JS dirs +**/__pycache__ +**/node_modules + +# env files +**/.env +**/.env.local +**/.env.*.local + +# log files +**/npm-debug.log* +**/yarn-debug.log* +**/yarn-error.log* +**/pnpm-debug.log* diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..22cac02 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,14 @@ +--- +kind: pipeline +name: default + +steps: +- name: ovdashboard + image: plugins/docker + settings: + repo: ldericher/ovdashboard + auto_tag: true + username: + from_secret: DOCKER_USERNAME + password: + from_secret: DOCKER_PASSWORD diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cd8925f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +############ +# build ui # +############ + +FROM node:lts-alpine AS build-ui + +# some dir for our code +WORKDIR /app + +# install dependencies +COPY ui/package*.json ui/yarn*.lock ./ +RUN yarn --production=false + +# copy code +COPY ui . +RUN yarn build + + +############## +# webservice # +############## + +FROM antonapetrov/uvicorn-gunicorn:python3.9-alpine3.13 AS production + +RUN set -ex; \ + # prerequisites + apk add --no-cache \ + libmagic \ + ; + +# env setup +ENV \ + PRODUCTION_MODE="true" \ + APP_MODULE="ovdashboard_api:app" + +# install API +COPY api /usr/src/ovdashboard_api +RUN set -ex; \ + pip3 --no-cache-dir install /usr/src/ovdashboard_api; + +# install UI +COPY --from=build-ui /app/dist /html \ No newline at end of file