feat: add Docker workflow for building and pushing images
This commit is contained in:
parent
f9a9945f1f
commit
371a763b9e
|
|
@ -115,3 +115,33 @@ jobs:
|
|||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: gh release edit ${{ github.ref_name }} --repo ${{ github.repository }} --draft=false
|
||||
|
||||
docker:
|
||||
needs: publish
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Extract version from tag
|
||||
id: version
|
||||
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/dbx:${{ steps.version.outputs.version }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/dbx:latest
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ RUN npm i -g pnpm
|
|||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install --frozen-lockfile
|
||||
COPY src/ src/
|
||||
COPY index.html vite.config.ts tsconfig.json tsconfig.app.json tsconfig.node.json ./
|
||||
COPY index.html vite.config.ts tsconfig.json ./
|
||||
COPY tailwind.config.* postcss.config.* ./
|
||||
RUN pnpm build
|
||||
|
||||
|
|
@ -24,7 +24,6 @@ RUN cargo build --release -p dbx-web
|
|||
|
||||
# Stage 3: Final image
|
||||
FROM debian:bookworm-slim
|
||||
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
COPY --from=backend /app/target/release/dbx-web /usr/local/bin/
|
||||
COPY --from=frontend /app/dist /app/static
|
||||
ENV DBX_STATIC_DIR=/app/static
|
||||
|
|
|
|||
Loading…
Reference in New Issue