Skip to content

Commit

Permalink
feat(ci): added frontend build
Browse files Browse the repository at this point in the history
  • Loading branch information
akorzunin committed Jul 30, 2024
1 parent 624cd4b commit e9291e8
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 3 deletions.
32 changes: 32 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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/go/build-context-dockerignore/

**/.DS_Store
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
33 changes: 31 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,35 @@ jobs:
frontend:
- 'web/**'
- name: frontend test
- name: Login to GitHub Container Registry
if: steps.filter.outputs.frontend == 'true'
run: echo aboba
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
if: steps.filter.outputs.frontend == 'true'
id: meta
uses: docker/metadata-action@v5.5.1
with:
images: akorzunin/supericosahedron-frontend

- name: Set up Docker Buildx
if: steps.filter.outputs.frontend == 'true'
uses: docker/setup-buildx-action@v3.6.1
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7

- name: Build and push Docker image
if: steps.filter.outputs.frontend == 'true'
id: push
uses: docker/build-push-action@v6.5.0
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
file: ./web/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
18 changes: 18 additions & 0 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

FROM --platform=$BUILDPLATFORM node:21.7.1-alpine AS frontend
WORKDIR /usr/src/app

RUN --mount=type=bind,source=./web/package.json,target=package.json \
--mount=type=cache,target=/root/.npm \
npm i

COPY ./web .

RUN npm run build


FROM alpine:latest AS frontend-final
WORKDIR /src

# Copy the executable from the "build" stage.
COPY --from=frontend /usr/src/app/dist ./web/dist
2 changes: 1 addition & 1 deletion web/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const Header = () => {
</h2>
<div className="flex gap-3">
<Button asChild>
<a href="/download/">download</a>
<a href="/download/">download_2</a>
</Button>
<Button>source code</Button>
<Button disabled>steam</Button>
Expand Down

0 comments on commit e9291e8

Please sign in to comment.