Load upload dir from ENV
This commit is contained in:
parent
0842c107e6
commit
cbd03de6a3
@ -8,8 +8,10 @@ COPY . .
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM node:21-alpine
|
FROM node:21-alpine
|
||||||
USER node:node
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
RUN chown -R node:node /app
|
||||||
|
USER node:node
|
||||||
|
COPY ./container/entrypoint.sh /entrypoint.sh
|
||||||
COPY package.json .
|
COPY package.json .
|
||||||
COPY --from=builder /app/build ./build
|
COPY --from=builder /app/build ./build
|
||||||
CMD ["node", "./build/index.js"]
|
ENTRYPOINT ["sh", "/entrypoint.sh"]
|
||||||
|
12
container/entrypoint.sh
Executable file
12
container/entrypoint.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export STORAGE_PATH="${STORAGE_PATH:-./uploads}"
|
||||||
|
|
||||||
|
entrypoint() {
|
||||||
|
mkdir -p "${STORAGE_PATH}"
|
||||||
|
node ./build/index.js
|
||||||
|
}
|
||||||
|
|
||||||
|
entrypoint
|
@ -1,6 +1,6 @@
|
|||||||
// place files you want to import through the `$lib` alias in this folder.
|
// place files you want to import through the `$lib` alias in this folder.
|
||||||
|
|
||||||
const safePath = (input: string) => input.replace(/\W/g, '');
|
const safePath = (input: string) => input.replace(/\W/g, '');
|
||||||
export const storagePath: string = './uploads';
|
export const storagePath: string = process.env.STORAGE_PATH;
|
||||||
|
|
||||||
export default safePath;
|
export default safePath;
|
||||||
|
Reference in New Issue
Block a user