Skip to content

Commit 1d3f94f

Browse files
authored
feat: First version (#2)
1 parent 7c6bdcb commit 1d3f94f

File tree

8 files changed

+207
-1
lines changed

8 files changed

+207
-1
lines changed

.github/dependabot.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: docker
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
labels:
9+
- dependencies
10+
commit-message:
11+
prefix: fix
12+
include: scope
13+
- package-ecosystem: github-actions
14+
directory: "/"
15+
schedule:
16+
interval: daily
17+
open-pull-requests-limit: 10
18+
labels:
19+
- dependencies
20+
commit-message:
21+
prefix: ci
22+
include: scope

.github/semantic.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
titleOnly: true
2+
types:
3+
- feat
4+
- fix
5+
- docs
6+
- refactor
7+
- test
8+
- build
9+
- ci
10+
- chore
11+
- revert

.github/workflows/ci-cd.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI/CD on master
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
env:
8+
IMAGE_NAME: "ghcr.io/techcentr/nodejs-devenv"
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
packages: write
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- name: "Determine release version"
20+
uses: docker://ghcr.io/codfish/semantic-release-action:v1.9.0
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Verify Dockerfile with Hadolint
25+
uses: brpaz/[email protected]
26+
27+
- name: "Build Docker image"
28+
if: env.RELEASE_VERSION != ''
29+
run: |
30+
docker build . -t "$IMAGE_NAME:$RELEASE_VERSION" \
31+
--label "org.label-schema.schema-version=1.0" \
32+
--label "org.label-schema.vcs-ref=${GITHUB_SHA}" \
33+
--label "org.label-schema.vcs-url=https://github.com/${GITHUB_REPOSITORY}" \
34+
--label "org.label-schema.url=https://github.com/${GITHUB_REPOSITORY}" \
35+
--label "org.label-schema.vendor=HomeCentr" \
36+
--label "version=$RELEASE_VERSION" \
37+
--label "org.label-schema.build-date=$(date '+%F %T')"
38+
39+
- name: "Tag image as latest"
40+
if: env.RELEASE_VERSION != ''
41+
run: "docker tag $IMAGE_NAME:$RELEASE_VERSION $IMAGE_NAME:latest"
42+
43+
- name: "Log into ghcr.io"
44+
if: env.RELEASE_VERSION != ''
45+
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
46+
47+
- name: "Push versioned image"
48+
if: env.RELEASE_VERSION != ''
49+
run: "docker push $IMAGE_NAME:$RELEASE_VERSION"
50+
51+
- name: "Push latest image"
52+
if: env.RELEASE_VERSION != ''
53+
run: "docker push $IMAGE_NAME:latest"

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI PR/Branch
2+
on:
3+
push:
4+
branches-ignore:
5+
- main
6+
pull_request:
7+
8+
env:
9+
IMAGE_NAME: "ghcr.io/techcentr/nodejs-devenv"
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Set tag var
18+
id: vars
19+
run: echo ::set-output name=docker_tag::$(echo ${GITHUB_REF} | cut -d'/' -f3)-${GITHUB_SHA}
20+
21+
- name: Verify Dockerfile with Hadolint
22+
uses: brpaz/[email protected]
23+
24+
- name: Build Docker image
25+
run: docker build . -t ${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.docker_tag }}

Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM node:14.16-alpine3.13
2+
3+
# Install glibc compatibility for alpine - required by AWS CLI v2
4+
ENV GLIBC_VER=2.31-r0
5+
6+
ADD https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub /etc/apk/keys/sgerrand.rsa.pub
7+
ADD https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk /tmp/glibc.apk
8+
ADD https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk /tmp/glibc-bin.apk
9+
ADD https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-i18n-${GLIBC_VER}.apk /tmp/glibc-i18n.apk
10+
11+
# Not required - version is pinned by downloading a specific version of the package
12+
# hadolint ignore=DL3018
13+
RUN apk add --no-cache \
14+
/tmp/glibc.apk \
15+
/tmp/glibc-bin.apk \
16+
/tmp/glibc-i18n.apk && \
17+
/usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8 && \
18+
# Clean up
19+
rm -rf /tmp/glib* \
20+
/var/cache/apk/*
21+
22+
# Install AWS CLI
23+
ADD https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip ./awscliv2.zip
24+
25+
RUN unzip awscliv2.zip && \
26+
./aws/install && \
27+
# Clean up
28+
rm -rf ./awscliv2.zip \
29+
./aws \
30+
/usr/local/aws-cli/v2/*/dist/awscli/examples \
31+
/usr/local/aws-cli/v2/*/dist/awscli/data/ac.index
32+
33+
# Install Docker CLI - useful for local development
34+
RUN apk add --no-cache docker-cli=20.10.3-r1
35+
36+
# Install Git - required for actions/checkout@v2
37+
RUN apk add --no-cache git=2.30.2-r0
38+
39+
ENTRYPOINT [ "ash" ]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 Lukas Holota
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,15 @@
1-
# docker-nodejs-devenv
1+
## Pulling the image
2+
3+
```
4+
docker pull ...tba...
5+
```
6+
7+
## Available tags
8+
9+
- `nodejs-devenv:<version>-node14-alpine` - based on NodeJS v14 alpine image
10+
11+
## Installed software
12+
The image contains other required software. For full list, check the [Dockerfile](./Dockerfile).
13+
14+
## Entrypoint
15+
Unlike the default NodeJS image, the entrypoint has been changed to the default shell (ash).

package.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "techcentr-nodejs-devenv",
3+
"version": "1.0.0",
4+
"description": "",
5+
"repository": {
6+
"type": "git",
7+
"url": "git+https://github.com/techcentr/docker-nodejs-devenv"
8+
},
9+
"release": {
10+
"branches": [
11+
"main"
12+
],
13+
"plugins": [
14+
"@semantic-release/commit-analyzer",
15+
"@semantic-release/release-notes-generator",
16+
"@semantic-release/github"
17+
]
18+
},
19+
"author": "Lukas Holota",
20+
"license": "MIT"
21+
}

0 commit comments

Comments
 (0)