Add dockerfile
This commit is contained in:
@@ -0,0 +1,14 @@
|
|||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
Dockerfile
|
||||||
|
.dockerignore
|
||||||
|
README.md
|
||||||
|
LICENSE
|
||||||
|
node_modules/
|
||||||
|
coverge/
|
||||||
|
# dotenv environment variable files
|
||||||
|
.env
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
.env.local
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
FROM node:23-alpine3.21
|
||||||
|
RUN apk upgrade --update-cache --available
|
||||||
|
|
||||||
|
LABEL version=0.0.1 description="BadgeDex"
|
||||||
|
|
||||||
|
# Create a group and user && Create directory for files
|
||||||
|
RUN mkdir /app && addgroup -S badgedex && adduser -h /app -S badgedex -g "Badgedex User" -G badgedex && chown -R badgedex:badgedex /app && chmod -R 755 /app
|
||||||
|
|
||||||
|
#Switch to working directory
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Tell docker that all future commands should run as the appuser user
|
||||||
|
USER badgedex
|
||||||
|
|
||||||
|
# Bundle app source. Create .dockerignore not copy all files from source directory
|
||||||
|
COPY --chown=badgedex:badgedex . .
|
||||||
|
|
||||||
|
#Install dependencies
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# Expose API port
|
||||||
|
EXPOSE 3000
|
||||||
|
#Start node application
|
||||||
|
ENTRYPOINT ["npm"]
|
||||||
|
|
||||||
|
CMD [ "start" ]
|
||||||
Reference in New Issue
Block a user