I'm pretty new to Docker and I was asked to write an api with node, express and postgres and dockerize it.
I created the Dockerfile:
FROM node:12.12.0-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD [ "npm", "start" ]
And the docker-compose.yml:
version: "3"
services:
app:
build: .
command: sh -c "npm run migrate up && npm start"
ports:
- 3000:3000
working_dir: /app
depends_on:
- db
environment:
- DATABASE_URL=postgres://root:password@db:5432/chargeflow
db:
image: postgres
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=password
- POSTGRES_DB=chargeflow
- POSTGRES_HOST_AUTH_METHOD=trust
volumes:
- ./db/data/postgres:/var/lib/postgresql/data
ports:
- 5432:5432
But when i build the docker-compose is get this errors/warnings:
app_1 |
app_1 | > [email protected] migrate /app
app_1 | > node-pg-migrate "up"
app_1 |
app_1 | Can't determine timestamp for 20210128200430-create-tweet
app_1 | Can't determine timestamp for 20210128200611-create-like
app_1 | Can't determine timestamp for 20210128200656-create-re-tweet
app_1 | > Migrating files:
app_1 | > - 20210128200430-create-tweet
app_1 | > - 20210128200611-create-like
app_1 | > - 20210128200656-create-re-tweet
What I'm doing wrong?
Thanks!
question from:
https://stackoverflow.com/questions/65947221/how-to-dockerize-nodepostgres 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…