Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jimwashbrook committed Mar 19, 2024
0 parents commit 5953ecd
Show file tree
Hide file tree
Showing 5 changed files with 10,620 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/build-image-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#
name: Create and publish a Docker image

# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
push:
branches: ['main']

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
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/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: "--allow-insecure-entitlement network.host"
driver-opts: network=host

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/*
node_modules/
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM alpine:3.19.1 as builder

WORKDIR /app

RUN apk update
RUN apk add nodejs npm

COPY package*.json .
RUN npm ci --omit=dev
COPY . .

RUN npm audit

FROM alpine:3.19.1

WORKDIR /app

RUN apk update
RUN apk add nodejs

COPY --from=builder /app/ /
COPY --from=builder /app/node_modules node_modules/
COPY package.json .

ENV NODE_ENV=production

ENTRYPOINT [ "/bin/sh" ]
Loading

0 comments on commit 5953ecd

Please sign in to comment.