mirror of
https://github.com/PretendoNetwork/juxtaposition-ui.git
synced 2026-04-25 16:20:11 -05:00
chore: update Docker configuration
This commit is contained in:
parent
95fab2bae9
commit
58600b945e
|
|
@ -1,5 +1,6 @@
|
|||
.git
|
||||
.env
|
||||
node_modules
|
||||
config.json
|
||||
certs
|
||||
src/logs
|
||||
dist
|
||||
logs
|
||||
uploads
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -2,3 +2,4 @@ node_modules
|
|||
config.json
|
||||
certs
|
||||
src/logs
|
||||
uploads
|
||||
|
|
|
|||
55
Dockerfile
55
Dockerfile
|
|
@ -1,15 +1,52 @@
|
|||
FROM node:18-alpine
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
RUN apk add --no-cache python3 make gcc g++
|
||||
WORKDIR /app
|
||||
ARG app_dir="/home/node/app"
|
||||
|
||||
COPY "docker/entrypoint.sh" ./
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
# * Base Node.js image
|
||||
FROM node:20-alpine AS base
|
||||
ARG app_dir
|
||||
WORKDIR ${app_dir}
|
||||
|
||||
COPY . ./
|
||||
|
||||
VOLUME [ "/app/config.json", "/app/certs" ]
|
||||
# * Installing production dependencies
|
||||
FROM base AS dependencies
|
||||
|
||||
CMD ["sh", "entrypoint.sh"]
|
||||
RUN --mount=type=bind,source=package.json,target=package.json \
|
||||
--mount=type=bind,source=package-lock.json,target=package-lock.json \
|
||||
--mount=type=cache,target=/root/.npm \
|
||||
npm ci --omit=dev
|
||||
|
||||
|
||||
# * Installing development dependencies and building the application
|
||||
FROM base AS build
|
||||
|
||||
RUN --mount=type=bind,source=package.json,target=package.json \
|
||||
--mount=type=bind,source=package-lock.json,target=package-lock.json \
|
||||
--mount=type=cache,target=/root/.npm \
|
||||
npm ci
|
||||
|
||||
COPY . .
|
||||
# TODO: re-enable after TypeScript migration
|
||||
#RUN npm run build
|
||||
|
||||
|
||||
# * Running the final application
|
||||
FROM base AS final
|
||||
ARG app_dir
|
||||
|
||||
RUN mkdir -p ${app_dir}/src/logs && chown node:node ${app_dir}/src/logs \
|
||||
&& mkdir -p ${app_dir}/uploads && chown node:node ${app_dir}/uploads
|
||||
|
||||
ENV NODE_ENV=production
|
||||
USER node
|
||||
|
||||
COPY package.json .
|
||||
|
||||
COPY --from=dependencies ${app_dir}/node_modules ${app_dir}/node_modules
|
||||
COPY --from=build ${app_dir} ${app_dir}
|
||||
|
||||
# TODO: change back after TypeScript migration
|
||||
#COPY --from=build ${app_dir}/dist ${app_dir}/dist
|
||||
|
||||
CMD ["node", "."]
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
files='config.json certs/access/private.pem certs/access/aes.key'
|
||||
|
||||
for file in $files; do
|
||||
if [ ! -f $file ]; then
|
||||
echo "$PWD/$file file does not exist. Please mount and try again."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
exec node src/server.js
|
||||
Loading…
Reference in New Issue
Block a user