Add dockerfile

This commit is contained in:
2025-07-11 10:41:15 +02:00
parent a2da535291
commit a00d273e29
2 changed files with 40 additions and 0 deletions
+14
View File
@@ -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
View File
@@ -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" ]