Skip to content

Conversation

timothystewart6
Copy link

@timothystewart6 timothystewart6 commented Feb 21, 2025

This supersedes #20 and #19

I tried to keep this PR minimal but it kept growing as I needed to make sure that the production container could build

  • Updated docs
  • Added docker compose with Docker file and overrides
  • compose runs postgres (along with health check) and runs the build version of your code, logs to console
  • added devcontainer
  • All the developer needs to do is clone repo and run docker compose up --build to start the local env
  • Dockerfile can be used for dev and prod
  • Moved some devDeps that were in deps

Docker build commands

dev
docker build --target dev --build-arg NODE_ENV=development -t cloud-api-dev .
docker run -p 3000:3000 -e NODE_ENV=development cloud-api

prod
docker build --target prod --build-arg NODE_ENV=production -t cloud-api-prod .
docker run -p 3000:3000 -e NODE_ENV=production cloud-api

@timothystewart6 timothystewart6 force-pushed the docker-dev branch 2 times, most recently from 6e10356 to 9002e20 Compare February 21, 2025 03:49
@timothystewart6 timothystewart6 force-pushed the docker-dev branch 3 times, most recently from d812f22 to 3557bbe Compare February 22, 2025 03:23
- postgres
volumes:
- .:/app
command: ["sh", "-c", "npm install && npm run dev"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't npm ci && npm run dev be more intentional about packages?

@CLAassistant
Copy link

CLAassistant commented Sep 22, 2025

CLA assistant check
All committers have signed the CLA.

# Base Stage
FROM node:22.14.0-bullseye-slim AS base
WORKDIR /app
COPY package.json package-lock.json ./
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really should be be moved down.

FROM base AS deps
COPY package.json package-lock.json ./
RUN npm ci

CMD ["sh", "-c", "npm run dev"]

# Production Stage
FROM node:22.14.0-bullseye-slim AS prod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be

FROM base AS prod

(and the WORKDIR line here deleted)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants