Skip to content

Commit

Permalink
Dockerize (#47)
Browse files Browse the repository at this point in the history
* improve: update dependency to remove stylelint deprecation warning

* feat: dockerize app

* feat: add workflow to publish container at ghcr

* chore: add newline

* chore: remove unneeded silent flag
  • Loading branch information
bobhageman authored Nov 23, 2023
1 parent 3757c2b commit 3c9c7e2
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 9 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build
**/.git
**/.DS_Store
**/node_modules
43 changes: 43 additions & 0 deletions .github/workflows/delivery.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Delivery

on:
push:
branches: [ master ]
release:
# Note: a current limitation is that when a release is edited after publication, then the Docker tags are not automatically updated.
types: [ published ]

permissions:
contents: write
packages: write

jobs:
publish-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{major}}.{{minor}}.{{patch}}
type=raw,value=edge
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build container and push to GitHub Container Registry
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM node:16

FROM node:21-alpine as build
WORKDIR /app
COPY . /app
RUN yarn install --immutable --immutable-cache --check-cache
RUN yarn build

COPY . .

RUN yarn

CMD [ "yarn", "start" ]
FROM joseluisq/static-web-server:latest
COPY --from=build /app/build /public
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.7'

services:

app:
build:
context: .
dockerfile: Dockerfile
ports:
- 3000:80
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"stylelint": "^15.10.1",
"stylelint-config-recommended-scss": "^12.0.0",
"stylelint-prettier": "^3.0.0",
"stylelint-scss": "^5.0.1"
"stylelint-scss": "^5.3.1"
},
"scripts": {
"lint": "eslint . --ext .js && stylelint ./src",
Expand Down
18 changes: 17 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6204,6 +6204,11 @@ known-css-properties@^0.27.0:
resolved "https://registry.yarnpkg.com/known-css-properties/-/known-css-properties-0.27.0.tgz#82a9358dda5fe7f7bd12b5e7142c0a205393c0c5"
integrity sha512-uMCj6+hZYDoffuvAJjFAPz56E9uoowFHmTkqRtRq5WyC5Q6Cu/fTZKNQpX/RbzChBYLLl3lo8CjFZBAZXq9qFg==

known-css-properties@^0.29.0:
version "0.29.0"
resolved "https://registry.yarnpkg.com/known-css-properties/-/known-css-properties-0.29.0.tgz#e8ba024fb03886f23cb882e806929f32d814158f"
integrity sha512-Ne7wqW7/9Cz54PDt4I3tcV+hAyat8ypyOGzYRJQfdxnnjeWsTxt1cy8pjvvKeI5kfXuyvULyeeAvwvvtAX3ayQ==

language-subtag-registry@~0.3.2:
version "0.3.22"
resolved "https://registry.yarnpkg.com/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz#2e1500861b2e457eba7e7ae86877cbd08fa1fd1d"
Expand Down Expand Up @@ -8696,7 +8701,7 @@ stylelint-prettier@^3.0.0:
dependencies:
prettier-linter-helpers "^1.0.0"

stylelint-scss@^5.0.0, stylelint-scss@^5.0.1:
stylelint-scss@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/stylelint-scss/-/stylelint-scss-5.0.1.tgz#b33a6580b5734eace083cfc2cc3021225e28547f"
integrity sha512-n87iCRZrr2J7//I/QFsDXxFLnHKw633U4qvWZ+mOW6KDAp/HLj06H+6+f9zOuTYy+MdGdTuCSDROCpQIhw5fvQ==
Expand All @@ -8706,6 +8711,17 @@ stylelint-scss@^5.0.0, stylelint-scss@^5.0.1:
postcss-selector-parser "^6.0.13"
postcss-value-parser "^4.2.0"

stylelint-scss@^5.3.1:
version "5.3.1"
resolved "https://registry.yarnpkg.com/stylelint-scss/-/stylelint-scss-5.3.1.tgz#7f0f5f06d0a2a3c515aa71d3a8de3548045e03e1"
integrity sha512-5I9ZDIm77BZrjOccma5WyW2nJEKjXDd4Ca8Kk+oBapSO4pewSlno3n+OyimcyVJJujQZkBN2D+xuMkIamSc6hA==
dependencies:
known-css-properties "^0.29.0"
postcss-media-query-parser "^0.2.3"
postcss-resolve-nested-selector "^0.1.1"
postcss-selector-parser "^6.0.13"
postcss-value-parser "^4.2.0"

stylelint@^15.10.1:
version "15.10.1"
resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-15.10.1.tgz#93f189958687e330c106b010cbec0c41dcae506d"
Expand Down

0 comments on commit 3c9c7e2

Please sign in to comment.