Skip to content

Commit

Permalink
Add dockerfile build and push workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cuchi committed Jan 18, 2024
1 parent 42b26e4 commit d2f9b7b
Show file tree
Hide file tree
Showing 5 changed files with 3,314 additions and 2,063 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
node_modules
31 changes: 31 additions & 0 deletions .github/workflows/build-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build & Publish a Docker image

on:
push:
branches: ["master"]

jobs:
publish:

runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/[email protected]
with:
push: true
tags: ghcr.io/trusted/url-to-pdf-api:c-${{ github.sha }}
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ RUN apt update -y \
RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home node

USER node

ENV HOME=/home/node
ARG APP_HOME=/home/node/srv
WORKDIR $APP_HOME

COPY . ./
RUN npm install --only=production
RUN chown -R node:node $APP_HOME

USER node

COPY --chown=1000:1000 . ./
RUN npm install --omit=dev

EXPOSE $PORT
CMD [ "node", "." ]
Loading

0 comments on commit d2f9b7b

Please sign in to comment.