Skip to content

Commit 681bbcb

Browse files
committed
tweaks
1 parent c982d31 commit 681bbcb

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build Stackpack Vanilla React App Image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Docker image tag'
8+
required: false
9+
default: 'latest'
10+
type: string
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
IMAGE_NAME: ${{ github.repository }}-stackpack
15+
DOCKERFILE_PATH: images/VanillaReactDockerFile
16+
17+
jobs:
18+
build-and-push:
19+
runs-on: ubuntu-latest
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
35+
- name: Extract metadata for Docker
36+
id: meta
37+
uses: docker/metadata-action@v5
38+
with:
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40+
tags: |
41+
type=raw,value=${{ inputs.tag }}
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: frontend
47+
file: ${{ env.DOCKERFILE_PATH }}
48+
push: true
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}

images/VanillaReactDockerFile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM debian:slim
2+
3+
# Install dependencies
4+
RUN apt-get update && \
5+
apt-get install -y --no-install-recommends \
6+
curl \
7+
wget \
8+
zip \
9+
unzip \
10+
tree && \
11+
# Install Node.js
12+
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
13+
apt-get install -y --no-install-recommends nodejs && \
14+
# Clean up
15+
apt-get clean && \
16+
rm -rf /var/lib/apt/lists/*
17+
18+
# Verify Node.js and npm installation
19+
RUN node --version && npm --version
20+
21+
WORKDIR /app
22+
23+
# Copy package files
24+
COPY package*.json ./
25+
26+
# Install dependencies
27+
RUN npm install
28+
29+
# Copy the rest of the application
30+
COPY . .
31+
32+
# Build the application
33+
RUN npm run build
34+
35+
# Expose port 3000
36+
EXPOSE 3000

0 commit comments

Comments
 (0)