Skip to content

Commit

Permalink
ci: Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ElaBosak233 committed Nov 15, 2024
1 parent eb62afd commit 035d2a7
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Docker Build & Push

on:
push:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
repository: cdsctf/cdsuno
ref: ${{ github.ref }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub Registry
uses: docker/login-action@v3
with:
registry: docker.io
username: elabosak233
password: ${{ secrets.DOCKER_TOKEN }}

- name: Docker metadata action
uses: docker/metadata-action@v5
id: meta
with:
images: |
docker.io/${{ github.repository_owner }}/cdsuno
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,enable=true,priority=100,prefix=,suffix=,format=short
- name: Build and Push
uses: docker/build-push-action@v3
with:
context: ./
file: ./Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
push: true
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM node:20 AS builder

COPY ./web /app

WORKDIR /app

RUN npm install
RUN npm run build

FROM scratch

COPY --from=builder /app/dist /app

0 comments on commit 035d2a7

Please sign in to comment.