-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add dockerfile, update node version, use yarn instead of npm (#38
) * chore: use yarn instead of npm, minor vue update, major ts update, align @types/node to v16 * chore: add docker and compose support * fix(ts): tackle build errors, no-check some files, assert some assignements * fix: update gh action to use nvmrc and yarn * feat(actions): gh action to push image to ghcr * fix: yarn instead of npm to build in action
- Loading branch information
Showing
20 changed files
with
8,276 additions
and
25,173 deletions.
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,34 @@ | ||
# Include any files or directories that you don't want to be copied to your | ||
# container here (e.g., local build artifacts, temporary files, etc.). | ||
# | ||
# For more help, visit the .dockerignore file reference guide at | ||
# https://docs.docker.com/engine/reference/builder/#dockerignore-file | ||
|
||
**/.classpath | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/.next | ||
**/.cache | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/charts | ||
**/docker-compose* | ||
**/compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
**/build | ||
**/dist | ||
LICENSE | ||
README.md |
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
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,43 @@ | ||
name: Publish image to GHCR | ||
|
||
on: | ||
workflow_call: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: vechain/insight-app | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Download artifact explorer | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: insight-app | ||
path: /tmp | ||
- name: Load Docker images | ||
run: | | ||
docker load --input /tmp/insight-app.tar | ||
docker image ls -a | ||
- name: Tags images to publish | ||
run: | | ||
timestamp=`date +%s` | ||
docker tag insight-app ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${timestamp} | ||
docker tag insight-app ${{env.REGISTRY}}/${{env.IMAGE_NAME}} | ||
docker tag insight-app ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{github.sha}} | ||
- name: Publish images | ||
run: | | ||
docker push -a ${{env.REGISTRY}}/${{env.IMAGE_NAME}} |
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 @@ | ||
v16.20.0 |
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,53 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Dockerfile reference guide at | ||
# https://docs.docker.com/engine/reference/builder/ | ||
|
||
ARG NODE_VERSION=16.20.0 | ||
|
||
################################################################################ | ||
# Use node image for base image for all stages. | ||
FROM node:${NODE_VERSION}-alpine AS base | ||
|
||
# Set working directory for all build stages. | ||
WORKDIR /usr/src/app | ||
|
||
|
||
################################################################################ | ||
# Create a stage for installing production dependecies. | ||
FROM base AS deps | ||
|
||
# Download dependencies as a separate step to take advantage of Docker's caching. | ||
# Leverage a cache mount to /root/.yarn to speed up subsequent builds. | ||
# Leverage bind mounts to package.json and yarn.lock to avoid having to copy them | ||
# into this layer. | ||
RUN --mount=type=bind,source=package.json,target=package.json \ | ||
--mount=type=bind,source=yarn.lock,target=yarn.lock \ | ||
--mount=type=cache,target=/root/.yarn \ | ||
yarn install --production --frozen-lockfile | ||
|
||
################################################################################ | ||
# Create a stage for building the application. | ||
FROM deps AS build | ||
|
||
# Download additional development dependencies before building, as some projects require | ||
# "devDependencies" to be installed to build. If you don't need this, remove this step. | ||
RUN --mount=type=bind,source=package.json,target=package.json \ | ||
--mount=type=bind,source=yarn.lock,target=yarn.lock \ | ||
--mount=type=cache,target=/root/.yarn \ | ||
yarn install --frozen-lockfile | ||
|
||
# Copy the rest of the source files into the image. | ||
COPY . . | ||
# Run the build script. | ||
RUN yarn run build | ||
|
||
################################################################################ | ||
# Create a new stage to run the application with minimal runtime dependencies | ||
# where the necessary files are copied from the build stage. | ||
FROM nginx:stable-alpine AS final | ||
COPY --from=build /usr/src/app/dist /usr/share/nginx/html | ||
# COPY --from=build /usr/src/app/nginx.prod.conf /etc/nginx/conf.d/default.conf | ||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] |
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,50 @@ | ||
# Comments are provided throughout this file to help you get started. | ||
# If you need more help, visit the Docker compose reference guide at | ||
# https://docs.docker.com/compose/compose-file/ | ||
|
||
# Here the instructions define your application as a service called "server". | ||
# This service is built from the Dockerfile in the current directory. | ||
# You can add other services your application may depend on here, such as a | ||
# database or a cache. For examples, see the Awesome Compose repository: | ||
# https://github.com/docker/awesome-compose | ||
services: | ||
server: | ||
build: | ||
context: . | ||
environment: | ||
NODE_ENV: production | ||
ports: | ||
- 8080:80 | ||
# The commented out section below is an example of how to define a PostgreSQL | ||
# database that your application can use. `depends_on` tells Docker Compose to | ||
# start the database before your application. The `db-data` volume persists the | ||
# database data between container restarts. The `db-password` secret is used | ||
# to set the database password. You must create `db/password.txt` and add | ||
# a password of your choosing to it before running `docker-compose up`. | ||
# depends_on: | ||
# db: | ||
# condition: service_healthy | ||
# db: | ||
# image: postgres | ||
# restart: always | ||
# user: postgres | ||
# secrets: | ||
# - db-password | ||
# volumes: | ||
# - db-data:/var/lib/postgresql/data | ||
# environment: | ||
# - POSTGRES_DB=example | ||
# - POSTGRES_PASSWORD_FILE=/run/secrets/db-password | ||
# expose: | ||
# - 5432 | ||
# healthcheck: | ||
# test: [ "CMD", "pg_isready" ] | ||
# interval: 10s | ||
# timeout: 5s | ||
# retries: 5 | ||
# volumes: | ||
# db-data: | ||
# secrets: | ||
# db-password: | ||
# file: db/password.txt | ||
|
Oops, something went wrong.