WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.git
*Dockerfile*
*docker-compose*
node_modules
.env*
.github
.husky
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GITHUB_TOKEN=<create-your-own-token>
GITHUB_REPOSITORY=sushie1984/pr-update-extended
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making a note here so we don't forget about it

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ typings/
# dotenv environment variables file
.env
.env.test
.env.dev*

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand Down
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM alpine:3.16.2 AS base
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason not to use the official Node image in alpine flavour?


RUN apk add --no-cache npm git openssh

WORKDIR /home/node/

COPY package.json package-lock-json* ./
Comment on lines +5 to +7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a benefit in first setting the work dir instead of directly copying in the file to the required location?


RUN npm install --omit=optional && npm cache clean --force

ENV PATH /home/node/node_modules/.bin:$PATH

WORKDIR /home/node/app

COPY . .

RUN git config --global --add safe.directory /home/node/app

ENTRYPOINT ["npm"]

FROM base AS dev

RUN npm install -g typescript ts-node
38 changes: 38 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.PHONY: copy_env
copy_env:
@cp -n .env.template .env.development
@cp -n .env.template .env.test

.PHONY: build
build:
docker-compose run --rm node run build

.PHONY: package
package:
@docker-compose run --rm dev run package

.PHONY: terminal
terminal:
@docker-compose run --rm --entrypoint /bin/ash dev

.PHONY: console
console:
@docker-compose run --rm --entrypoint /bin/ash dev -c "npx ts-node"

.PHONY: test
test:
@docker-compose run --rm test

.PHONY: lint
lint:
@docker-compose run --rm test run lint

.PHONY: format
format:
@docker-compose run --rm test run format

.PHONY: clean
clean:
@docker-compose down
@docker image prune -f
@docker images -a | grep "pr-update" | awk '{print $3}' | xargs docker rmi
35 changes: 35 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.8"
services:
dev:
env_file:
- .env.development
environment:
- SSH_AUTH_SOCK=${SSH_AUTH_SOCK}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you elaborate what this does? (not familiar with this EnvVar)

build:
context: .
target: dev
stdin_open: true
tty: true
volumes:
- ./:/home/node/app
- ${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK}
# Prevents unwanted mounting of node_modules from HOST into docker container.
- notused:/home/node/app/node_modules

test:
env_file:
- .env.test
environment:
- SSH_AUTH_SOCK=${SSH_AUTH_SOCK}
build:
context: .
target: base
command: run test
volumes:
- ./:/home/node/app
- ${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK}
# Prevents unwanted mounting of node_modules from HOST into docker container.
- notused:/home/node/app/node_modules

volumes:
notused: