mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-07-13 15:24:35 +00:00
Deprecated webapp (old stats stack)
This commit is contained in:
parent
aed14743e6
commit
c1fcb61731
54 changed files with 0 additions and 22410 deletions
|
|
@ -1,3 +0,0 @@
|
|||
.git
|
||||
node_modules
|
||||
public/dist
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
# [ Stage 1 ] - install node modules
|
||||
FROM node:12.2-alpine as builder
|
||||
RUN apk update
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY ./app/webapp/package.json /build/package.json
|
||||
COPY ./app/webapp/package-lock.json /build/package-lock.json
|
||||
|
||||
RUN npm install
|
||||
RUN npm i --global @adonisjs/cli
|
||||
|
||||
RUN npx adonis key:generate --echo
|
||||
|
||||
# ============================
|
||||
# ============================
|
||||
|
||||
# [ Stage 2 ]
|
||||
FROM node:12.2-alpine
|
||||
LABEL maintainer="Anthony Mineo <anthonymineo@gmail.com>"
|
||||
|
||||
RUN apk update && apk add --no-cache bash curl
|
||||
|
||||
# Default envs as prod
|
||||
ENV ENV_SILENT=true \
|
||||
HOST=0.0.0.0 \
|
||||
PORT=8080 \
|
||||
HASH_DRIVER=bcrypt \
|
||||
NODE_ENV=production \
|
||||
WEBPACK_HMR=false \
|
||||
CACHE_VIEWS=true \
|
||||
APP_NAME=AdonisJs
|
||||
ENV APP_URL=http://${HOST}:${PORT}
|
||||
|
||||
#ENV APP_KEY=you-need-to-generate-this
|
||||
# secrets path _FILE prefix or ENV K=V
|
||||
|
||||
|
||||
# Setup pm2 as our node process manager
|
||||
# https://pm2.keymetrics.io/docs/usage/docker-pm2-nodejs/
|
||||
RUN npm install pm2 -g
|
||||
|
||||
# Set node modules outside our app to keep it clean
|
||||
COPY --from=builder /build/node_modules/ /opt/node_modules/
|
||||
ENV PATH /opt/node_modules/.bin:$PATH
|
||||
|
||||
|
||||
# Start script and config
|
||||
COPY ./build/webapp/entrypoint.sh /entrypoint.sh
|
||||
|
||||
# Our App
|
||||
WORKDIR /app
|
||||
COPY ./app/webapp /app
|
||||
|
||||
RUN ln -nsf /opt/node_modules /app
|
||||
|
||||
|
||||
# Bake prod assets into image
|
||||
RUN rm -rf /app/public/dist && npm run webpack-server
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
|
||||
HEALTHCHECK --interval=20s --timeout=30s --start-period=5s --retries=5 \
|
||||
CMD curl -f http://localhost:8080/healthz || exit 1
|
||||
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "Node ENV: $NODE_ENV"
|
||||
|
||||
file_env() {
|
||||
local var="$1"
|
||||
local fileVar="${var}_FILE"
|
||||
local def="${2:-}"
|
||||
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
|
||||
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
|
||||
exit 1
|
||||
fi
|
||||
local val="$def"
|
||||
if [ "${!var:-}" ]; then
|
||||
val="${!var}"
|
||||
elif [ "${!fileVar:-}" ]; then
|
||||
val="$(< "${!fileVar}")"
|
||||
fi
|
||||
export "$var"="$val"
|
||||
unset "$fileVar"
|
||||
}
|
||||
|
||||
file_env 'APP_KEY'
|
||||
|
||||
|
||||
# Exit if APP_KEY is missing, this key is important!
|
||||
if [ -z "$APP_KEY" ]
|
||||
then
|
||||
echo >&2 "[ERROR] No ENV for APP_KEY or APP_KEY_FILE found!"
|
||||
echo >&2 "Run the ./generate-adonis-app-key.sh script or provide one at runtime"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
if [[ "$NODE_ENV" == "development" ]]; then
|
||||
echo "Prepping container for dev environment"
|
||||
echo "Setting a symlink for ./node_modules -> /opt/node_modules"
|
||||
ln -nsf /opt/node_modules /app
|
||||
|
||||
echo "Cleaning dist assets..."
|
||||
rm -rf /app/public/dist
|
||||
npm run webpack-server
|
||||
fi
|
||||
|
||||
# Generate a dist assets if they don't exist -- (If they were deleted on the volume mount)
|
||||
[ ! -d "/app/public/dist" ] && npm run webpack-server
|
||||
|
||||
|
||||
if [[ "$NODE_ENV" == "production" ]]; then
|
||||
pm2-runtime start /app/ecosystem._PROD_.config.js
|
||||
elif [[ "$WEBPACK_HMR" == "true" ]]; then
|
||||
pm2-runtime start /app/ecosystem._DEV_HOT_.config.js
|
||||
else
|
||||
pm2-runtime start /app/ecosystem._DEV_.config.js
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue