9/16/2023 0 Comments Pgadmin for mac m1![]() PgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL. Updated our docker-compose.Latest Blog Posts Configuring and Using Shared Storage in pgAdmin 4Īuthor: Nikhil Mohite, date: May 31, 2023.Updated our image by tweaking the Dockerfile by adding the Prisma Generate command.# Generate Prisma database client code RUN npm run prisma:generate # Use the node user from the image (instead of the root user) USER node # BUILD FOR PRODUCTION # Spin up Docker ComposeĬompared to the original Dockerfile and docker-compose.yml files at the start of this tutorial, we've made some changes to them and other files to get our local setup working with Prisma. # Install app dependencies using the `npm ci` command instead of `npm install` RUN npm ci # Bundle app source COPY -chown = node:node. ![]() ![]() # Copying this first prevents re-running npm install on every code change. ![]() # A wildcard is used to ensure copying both package.json AND package-lock.json (when available). # BUILD FOR LOCAL DEVELOPMENT # FROM node:18-alpine As development # Create app directory WORKDIR /usr/src/app # Copy application dependency manifests to the container image. You'll also need to make sure you have the 3 environment variables set in your local. Make sure you update the mention of docker-nest-postgres to more suitable values for your project. Added the postgres service with all the configurations we need to spin up a local Postgres server.This creates a dependency between the api service and the postgres service (useful as the NestJS service will need to access the Postgres database). Add a depends_on section to the api service.Here's the edits that have been made to the docker-compose.yml file: other Redis container configs postgres : image : postgresĮnvironment : POSTGRES_DB : $ ports : - '5432:5432' volumes : - docker -nest -postgres :/var/lib/postgresql/data other Nest container configs depends_on : - redis Add docker-compose fileĪdd a docker-compose.yml file to your project: See the # BUILD FOR LOCAL DEVELOPMENT stage in the Dockerfile above? That's what we'll isolate and target in the docker-compose.yml file. The great thing about multistage builds is that you can target a specific stage in your docker-compose file and run a specific command against the stage. dist # Start the server using the production build CMD node_modules COPY -chown = node:node -from = build /usr/src/app/dist. RUN npm ci -only=production & npm cache clean -force USER node # PRODUCTION # FROM node:18-alpine As production # Copy the bundled code from the build stage to the production image COPY -chown = node:node -from = build /usr/src/app/node_modules. # This ensures that the node_modules directory is as optimized as possible. # Passing in -only=production ensures that only the production dependencies are installed. # Run the build command which creates the production bundle RUN npm run build # Set NODE_ENV environment variable ENV NODE_ENV production # Running `npm ci` removes the existing node_modules directory. ![]() COPY -chown = node:node -from = development /usr/src/app/node_modules. # So we can copy over the node_modules directory from the development image into this build image. # The Nest CLI is a dev dependency, # In the previous development stage we ran `npm ci` which installed all dependencies. # In order to run `npm run build` we need access to the Nest CLI. # Use the node user from the image (instead of the root user) USER node # BUILD FOR PRODUCTION # FROM node:18-alpine As build WORKDIR /usr/src/app COPY -chown = node:node package*.json. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |