To build our bots docker image simply run:
docker build -t bot:v1 .
2019-03-16 10:59:30 ⌚ Matthews-MacBook-Pro-178 in ~/workspace/work/discord-bot-typescript-annotationdriven± |master S:1 U:3 ✗| → docker build -t bot:v1 .Sending build context to Docker daemon 133.4MBStep 1/9 : FROM node:alpine AS builder---> ebbf98230a82Step 2/9 : WORKDIR /app---> Using cache---> 20a4914d700aStep 3/9 : RUN adduser -S bot---> Using cache---> e822599b3590Step 4/9 : COPY package.json .---> Using cache---> 3b3f63ce4417Step 5/9 : RUN npm install---> Using cache---> 1e9f924bcc5dStep 6/9 : COPY . .---> af99287b9757Step 7/9 : RUN npm run build---> Running in cb8b02096cef> discord-bot-typescript-annotationdriven@1.0.0 build /app> tsc --build tsconfig.jsonRemoving intermediate container cb8b02096cef---> f07351e62b26Step 8/9 : USER bot---> Running in 6f96024515a5Removing intermediate container 6f96024515a5---> 9a18329f9b53Step 9/9 : ENTRYPOINT ["npm", "start"]---> Running in c65af7e9ea97Removing intermediate container c65af7e9ea97---> 51a85dcc78b6Successfully built 51a85dcc78b6Successfully tagged bot:v1
Now you can start your bot with:
docker run --name bot -d bot:v1
You can view the output/logs by running:
docker logs -f bot