diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e5c60ab --- /dev/null +++ b/.dockerignore @@ -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 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 682d448..e9c313a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 }} diff --git a/web/Dockerfile b/web/Dockerfile new file mode 100644 index 0000000..51f1aac --- /dev/null +++ b/web/Dockerfile @@ -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 diff --git a/web/src/components/Header.tsx b/web/src/components/Header.tsx index f100547..f710660 100644 --- a/web/src/components/Header.tsx +++ b/web/src/components/Header.tsx @@ -9,7 +9,7 @@ export const Header = () => {