Skip to content

Commit

Permalink
1.0.3: [feature] Creates Dockerfile for croncat agent
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorjdawson committed Jun 1, 2021
1 parent d4bf676 commit 1adb8d8
Show file tree
Hide file tree
Showing 4 changed files with 690 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@
node_modules

dist
.cache
.cache
.dockerignore
40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# = = = = = = = = = = = = = = = = = = = = = =
# Build Stage - This stage will intall node modules and build for prod
# = = = = = = = = = = = = = = = = = = = = = =
FROM mhart/alpine-node:latest as builder

WORKDIR /app

RUN apk add --no-cache python3 make g++

COPY package.json .
COPY yarn.lock .

RUN yarn

COPY . .

# Build and package the ap into a binary named 'croncat-agent'
RUN yarn package

# Copy the default .env values over
RUN mv .env.example .env

# = = = = = = = = = = = = = = = = = = = = = =
# Run stage
# This stage will run our app
# = = = = = = = = = = = = = = = = = = = = = =
FROM node:alpine

WORKDIR /app

# install required libs
RUN apk update && apk add --no-cache libstdc++ libgcc

# copy prebuilt binary from previous step
COPY --from=builder /app/croncat-agent croncat-agent
COPY --from=builder /app/.env .env

EXPOSE 2000

CMD [ "./croncat-agent" ]
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "croncat",
"version": "1.0.2",
"version": "1.0.3",
"description": "cron.cat CLI and Agent Runner",
"main": "src/index.js",
"scripts": {
"build": "babel src -d dist",
"start": "npm run build && node dist",
"restart": "rimraf dist && npm run start",
"dev": "nodemon --exec npm run restart",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"package": "yarn build && pkg -t node14-alpine-x64 --output croncat-agent dist/index.js"
},
"bin": {
"croncat": "bin/croncat"
Expand Down Expand Up @@ -47,6 +48,7 @@
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/preset-env": "^7.13.15",
"nodemon": "^2.0.7",
"pkg": "^5.2.1",
"rimraf": "^3.0.2"
}
}
Loading

0 comments on commit 1adb8d8

Please sign in to comment.