Skip to content

Commit

Permalink
docs: updates on documents
Browse files Browse the repository at this point in the history
Added information on project structure
  • Loading branch information
AlexRogalskiy committed Jun 6, 2021
1 parent 125da58 commit c1bcab2
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/.circleci
/.dependabot
/.github
/.husky
/.idea
/docs
/images
/coverage
/node_modules
npm-debug.log
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#####################################################
###### General settings
#####################################################
APP_HOSTNAME=styled-screenshots
APP_SERVER_PORT=3000
2 changes: 1 addition & 1 deletion .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/cache@v2.1.4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/qawolf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-semantic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-node-
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ lerna-debug.log*

# BlueJ files
*.ctxt
*.iml

# Cache files
.npm
Expand Down
4 changes: 4 additions & 0 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run validate:commit
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package-lock=false
save-exact=false
registry=http://registry.npmjs.org
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14.16.0
3 changes: 3 additions & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
save-prefix "^"
--no-lockfile true
unsafe-disable-integrity-migration true
51 changes: 32 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,52 @@ ARG IMAGE_TAG=lts-alpine

FROM $IMAGE_SOURCE:$IMAGE_TAG

MAINTAINER Alexander Rogalskiy <@AlexRogalskiy>
MAINTAINER Alexander Rogalskiy <github@AlexRogalskiy>

## Setting arguments
## General arguments
ARG LC_ALL="en_US.UTF-8"
ARG VERSION="0.0.0-dev"
ARG VCS_REF="$(date -u +\"%Y-%m-%dT%H:%M:%SZ\")"
ARG BUILD_DATE="$(git rev-parse --short HEAD)"
ARG HOME_DIR="/usr/src/app"
ARG VCS_REF="$(date -u +\"%Y-%m-%dT%H:%M:%SZ\")"

## Vercel token
ARG TOKEN

## Setting metadata
LABEL version=$VERSION
LABEL vcs-ref=$VCS_REF
LABEL build-date=$BUILD_DATE
## Working directories
ARG APP_DIR="/usr/src/app"
ARG DATA_DIR="/usr/src/data"

## General metadata
LABEL "com.github.repository"="https://github.com/AlexRogalskiy/screenshots"
LABEL "com.github.homepage"="https://github.com/AlexRogalskiy/screenshots"
LABEL "com.github.maintainer"="Sensiblemetrics, Inc. <hello@sensiblemetrics.io> (https://sensiblemetrics.io)"

LABEL name="Styled screenshots"
LABEL description="Automatically generate styled screenshots upon request (png, jpeg)"
LABEL repository="https://github.com/AlexRogalskiy/screenshots"
LABEL homepage="https://github.com/AlexRogalskiy"
LABEL maintainer="Nullables, Inc. <hello@nullables.io> (https://nullables.io)"
LABEL "com.github.version"="$VERSION"
LABEL "com.github.build-date"="$BUILD_DATE"
LABEL "com.github.vcs-ref"="$VCS_REF"

LABEL "com.github.name"="styled-screenshots"
LABEL "com.github.description"="Automatically generate styled SVG screenshots upon request"

## Setting environment variables
ENV HOME $HOME_DIR
ENV LC_ALL en_US.UTF-8
ENV APP_DIR $APP_DIR
ENV DATA_DIR $DATA_DIR
ENV LC_ALL $LC_ALL
ENV LANG $LC_ALL
ENV VERCEL_TOKEN $TOKEN

## Mounting volumes
VOLUME ["$APP_DIR"]

## Creating work directory
WORKDIR $APP_DIR

## Installing dependencies
RUN apk add --no-cache git

## Installing vercel
RUN npm i -g vercel

## Creating work directory
WORKDIR $HOME

## Copying project sources
COPY .vercel*/ ./.vercel
COPY api/ ./api
Expand All @@ -55,6 +64,10 @@ COPY package.json .

## Installing project dependencies
RUN npm install

## Run format checking & linting
RUN npm run all

RUN yes | vercel --confirm --token $VERCEL_TOKEN

## Setting volumes
Expand All @@ -64,4 +77,4 @@ VOLUME /tmp
EXPOSE 3000

## Running package bundle
CMD ["npm", "run", "develop:docker"]
CMD ["npm", "run", "development:docker"]
48 changes: 48 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: '3.9'

services:
app:
container_name: styled-screenshots
hostname: '$APP_HOSTNAME'
build:
context: './'
dockerfile: Dockerfile
restart: always
volumes:
- type: volume
source: appvolume
target: /usr/src/app
volume:
nocopy: true
- type: bind
source: ./data
target: /usr/src/data
healthcheck:
test: ['CMD-SHELL', 'nc', '-vz', 'localhost', '3000']
interval: 3s
retries: 15
start_period: 30s
networks:
- default
ports:
- '${IP_ADDRESS:-127.0.0.1}:${APP_SERVER_PORT:-3000}:3000'
deploy:
mode: global
logging:
options:
max-size: '100m'
max-file: '10'

networks:
default:
driver: bridge
driver_opts:
com.docker.network.driver.mtu: 1450

volumes:
appvolume:
driver: local
driver_opts:
o: bind
type: none
device: ./
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"lint": "eslint --cache --fix --quiet --cache-location ./node_modules/.cache/ --format codeframe --ext js,ts .",
"lint:clean": "del-cli .eslintcache",
"lint:json": "jsonlint ./package.json --quiet",
"validate:commit": "validate-commit-msg",
"sample": "cd samples && tsc && node ./dist/screenshot.js",
"pretty": "pretty-quick --staged --pattern '!test/tests/lint/**'",
"license": "license-checker --json > licenses.json",
Expand All @@ -38,6 +39,7 @@
"test:watch": "env-cmd --silent -e test jest --watch",
"test:license": "license-checker --production --summary --unknown --onlyAllow=\"Apache-2.0;BSD;ISC;MIT;GPL-3.0;CC-BY-3.0;CC0-1.0;Unlicense;\"",
"lint:all": "npm run lint:clean && npm run lint && npm run lint:md && npm run lint:json",
"build-image": "docker build -f Dockerfile --tag styled-screenshots .",
"format:all": "npm run format && npm run format:md",
"check:all": "npm run format:check",
"test:all": "npm run test && npm run test:license",
Expand Down Expand Up @@ -103,7 +105,8 @@
"ts-jest": "^26.4.4",
"ts-node": ">=9.0.0",
"typedoc": "^0.20.28",
"typescript": "^4.1.3"
"typescript": "^4.1.3",
"validate-commit-msg": "^2.14.0"
},
"repository": {
"type": "git",
Expand Down Expand Up @@ -157,6 +160,7 @@
"husky": {
"hooks": {
"pre-commit": "npm test:all",
"post-commit": "npm validate:commit",
"pre-push": "npm run check:all"
}
},
Expand Down

1 comment on commit c1bcab2

@vercel
Copy link

@vercel vercel bot commented on c1bcab2 Jun 6, 2021

Choose a reason for hiding this comment

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

Deployment failed with the following error:

Resource is limited - try again after in 15 minutes (more than 100, code: "api-deployments-free-per-day").

Please sign in to comment.