chore: setup docker env

This commit is contained in:
Sonny
2024-04-27 17:30:54 +02:00
committed by Sonny
parent 1386db6935
commit 2531242615
7 changed files with 147 additions and 2 deletions

33
Dockerfile Normal file
View File

@@ -0,0 +1,33 @@
# Source: https://docs.adonisjs.com/cookbooks/dockerizing-adonis#document
FROM node:lts-alpine3.19
# Set working directory
WORKDIR /usr/src/app
# Install dependencies
COPY package*.json ./
RUN npm ci --omit="dev"
# Copy app source code
COPY . .
# Build app
RUN npm install
RUN npm run build --omit="dev"
COPY ./.env ./build
ENV PORT=$PORT
ENV HOST=0.0.0.0
ENV APP_KEY=DIhtF2IY1-MCAm_wlh3VYx7KLVOhpeOb
ENV NODE_ENV=production
ENV LOG_LEVEL=debug
ENV CACHE_VIEWS=false
ENV SESSION_DRIVER=cookie
# Expose port
EXPOSE $PORT
# Start app
CMD node build/bin/console.js migration:run --force && node build/bin/server.js