-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ghcr build and build scripts to package.json
- Loading branch information
Showing
4 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
**/node_modules | ||
**/dist | ||
.git | ||
.gitignore | ||
**/Dockerfile | ||
**/docker-compose.yml | ||
**/.env | ||
**/secrets/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
name: Create and publish a Docker image | ||
|
||
on: push | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
ANGULAR_IMAGE: quanted/vb-angular | ||
NGINX_IMAGE: quanted/vb-nginx | ||
|
||
jobs: | ||
build-angular: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.ANGULAR_IMAGE }} | ||
|
||
- name: Build and push Cyanweb Angular/Node Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
build-args: env=kube | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
build-nginx: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
needs: build-angular | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.NGINX_IMAGE }} | ||
|
||
- name: Build and push Cyanweb Nginx Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: docker/nginx/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
build-args: config=nginx.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM node:lts-alpine | ||
|
||
# Build-time variables (see package.json) | ||
ARG env=standalone | ||
|
||
# Env vars for angular unit tests and bypassing angular CLI install prompt: | ||
ENV CHROME_BIN=/usr/bin/chromium-browser \ | ||
CHROME_PATH=/usr/lib/chromium/ \ | ||
NG_CLI_ANALYTICS=false | ||
|
||
ENV APP_USER=www-data | ||
|
||
COPY . /app | ||
|
||
# COPY docker/ /docker | ||
|
||
WORKDIR /app | ||
|
||
RUN apk update && \ | ||
apk upgrade && \ | ||
apk add chromium | ||
|
||
# RUN npm install --force | ||
RUN npm install | ||
RUN npm run build:$env | ||
|
||
RUN adduser -S $APP_USER -G $APP_USER | ||
|
||
# RUN chown -R $APP_USER:$APP_USER /app /docker | ||
RUN chown -R $APP_USER:$APP_USER /app | ||
|
||
# Runs as non-root user "www-data" | ||
USER $APP_USER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters