Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* build and push docker image * few tweaks and api dockerfile * add github ci to build and publish docker image for api * new build for docker * new build for docker * small fix * small fix * small fix * small fix * small fix * small fix * added more details to .env.example
- Loading branch information
Showing
11 changed files
with
150 additions
and
14 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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
Makefile | ||
docker | ||
README.md | ||
docs | ||
.env | ||
|
@@ -8,4 +7,4 @@ docs | |
.idea | ||
node_modules | ||
nx | ||
.vscode | ||
.vscode |
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,57 @@ | ||
name: Create and publish a Docker image | ||
|
||
# Configures this workflow to run every time a change is pushed to the branch called `release`. | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'main' | ||
tags: | ||
- 'v*' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
|
||
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. | ||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Uses the `docker/login-action` action to log in to the Container registry using the account and | ||
# password that will publish the packages. Once published, the packages are scoped to the account defined here. | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
if: github.event_name != 'pull_request' | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USER }} | ||
password: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
|
||
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and | ||
# labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be | ||
# referenced in a subsequent step. The `images` value provides the base name for the tags and labels. | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | ||
${{ env.REGISTRY || 'docker.io' }}/${{ env.IMAGE_NAME || github.repository }} | ||
|
||
# This step uses the `docker/build-push-action` action to build the image, based on your | ||
# repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. | ||
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. | ||
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. | ||
- name: Build and push | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: ${{ github.event_name != 'pull_request' }} | ||
file: docker/deployments/api.dockerfile | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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 |
---|---|---|
|
@@ -13,3 +13,4 @@ | |
/.vscode | ||
pnpm-lock.yaml | ||
package.json | ||
.github |
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
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,46 @@ | ||
FROM ubuntu:22.04 | ||
|
||
ARG NODE_MAJOR=18 | ||
ARG NODE_ENV=production | ||
ENV NODE_ENV=${NODE_ENV} | ||
ENV TZ=UTC | ||
|
||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
RUN apt-get update | ||
RUN apt-get install -y ca-certificates curl gnupg supervisor | ||
RUN mkdir -p /etc/apt/keyrings | ||
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg | ||
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list | ||
RUN apt-get update | ||
RUN apt-get install nodejs -y | ||
RUN npm install -g npm | ||
RUN npm install -g yarn | ||
|
||
RUN apt-get install -y zip unzip supervisor libcap2-bin libpng-dev | ||
RUN apt-get -y autoremove | ||
RUN apt-get clean | ||
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
WORKDIR /app | ||
|
||
COPY ./package.json ./ | ||
|
||
RUN yarn install --production=false | ||
RUN yarn global add nx | ||
|
||
COPY . . | ||
|
||
RUN nx repair | ||
|
||
RUN nx run api:build:production | ||
|
||
COPY ./docker/deployments/start-container /usr/local/bin/start-container | ||
COPY ./docker/deployments/supervisord.conf /etc/supervisor/conf.d/supervisord.conf | ||
RUN chmod +x /usr/local/bin/start-container | ||
|
||
EXPOSE 3000 | ||
|
||
#ENTRYPOINT ["start-container"] | ||
ENTRYPOINT ["nx", "run", "api:serve"] | ||
#ENTRYPOINT ["bash"] |
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,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.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,18 @@ | ||
[supervisord] | ||
nodaemon=true | ||
user=root | ||
logfile=/var/log/supervisor/supervisord.log | ||
pidfile=/var/run/supervisord.pid | ||
|
||
[program:api] | ||
command=node /app/dist/apps/api/src/main.js | ||
autostart=true | ||
autorestart=true | ||
startretries=5 | ||
numprocs=1 | ||
startsecs=0 | ||
process_name=%(program_name)s_%(process_num)02d | ||
stderr_logfile=/var/log/supervisor/%(program_name)s_stderr.log | ||
stderr_logfile_maxbytes=10MB | ||
stdout_logfile=/var/log/supervisor/%(program_name)s_stdout.log | ||
stdout_logfile_maxbytes=10MB |
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
419277e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
isomera-compodoc – ./
isomera-compodoc-cortip.vercel.app
isomera-compodoc.vercel.app
isomera-compodoc-git-main-cortip.vercel.app
doc.isomera.org