aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2019-12-10 01:28:46 -0500
committerKevin J Hoerr <kjhoerr@protonmail.com>2019-12-10 01:28:46 -0500
commit5090797f199c4499921126133fc3e5ad4c142060 (patch)
treee1bfe131b6b9d2d605493c76462d005d256867ae /Dockerfile
parentefab55d4c8ebd3ae37917969c01cdf525829fa76 (diff)
downloadao-coverage-5090797f199c4499921126133fc3e5ad4c142060.tar.gz
ao-coverage-5090797f199c4499921126133fc3e5ad4c142060.tar.bz2
ao-coverage-5090797f199c4499921126133fc3e5ad4c142060.zip
Add multi-stage dockerfile as node:alpine image
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile36
1 files changed, 36 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..31b60f5
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,36 @@
+# Stage 1. Base
+FROM node:carbon AS base
+WORKDIR /app
+
+# Stage 2. Dependencies
+FROM base AS dependencies
+COPY package*.json ./
+RUN npm install
+
+# Stage 3. TS compilation
+FROM dependencies AS build
+COPY src /app/src
+COPY tsconfig.json /app
+RUN npm run tsc
+
+# Stage 4. Release Image
+FROM node:alpine AS release
+WORKDIR /app
+
+COPY --from=dependencies /app/package.json ./
+RUN npm install --only=production
+COPY --from=build /app/build ./build
+COPY public ./public
+
+ENV NODE_ENV=production \
+ PORT=8080 \
+ BIND_ADDRESS=0.0.0.0 \
+ UPLOAD_LIMIT=134217700 \
+ LOG_LEVEL=info \
+ HOST_DIR=/data
+
+RUN mkdir -p ${HOST_DIR}
+VOLUME [ ${HOST_DIR} ]
+EXPOSE ${PORT}
+
+CMD [ "node", "./build/index.js" ] \ No newline at end of file