Skip to content

Instantly share code, notes, and snippets.

@sp90
Last active July 7, 2023 08:15
Show Gist options
  • Save sp90/75bf3c3636a2e7ebffbafaa259769bdb to your computer and use it in GitHub Desktop.
Save sp90/75bf3c3636a2e7ebffbafaa259769bdb to your computer and use it in GitHub Desktop.
Digitalocean app platform dockerfile node 20
# Just for description purpose
# Make sure you remove the environment_slug and that you add the dockerfile_path
## BEFORE
services:
- environment_slug: node-js
envs:
...
## AFTER
services:
- envs:
...
dockerfile_path: Dockerfile
version: '3.7'
services:
ts-node-docker:
build:
context: .
dockerfile: Dockerfile
target: base
volumes:
- .:/app
container_name: ts-node-docker
expose:
- '3000'
ports:
- '3000:3000'
command: npm run start
FROM node:20 as base
# Create app directory
WORKDIR /app
# Copy lock files
COPY package.json bun.lockb package-lock.json ./
# Install app dependencies
RUN npm ci
# Bundle app source
COPY . /app
# Prod stage
FROM base as production
ENV NODE_PATH=./app
# No need to EXPOSE that is handle by the service running it DO and or docker-compose
# If you have a build
# RUN npm run build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment