Last active
July 7, 2023 08:15
-
-
Save sp90/75bf3c3636a2e7ebffbafaa259769bdb to your computer and use it in GitHub Desktop.
Digitalocean app platform dockerfile node 20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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