Skip to content

Commit 7b6232e

Browse files
committed
merge with ci
1 parent b555ec6 commit 7b6232e

File tree

6 files changed

+42
-65
lines changed

6 files changed

+42
-65
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.github/
2+
ui/node_modules

.github/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM node:18-alpine AS node
2+
3+
COPY ui/package.json /app/package.json
4+
COPY ui/package-lock.json /app/package-lock.json
5+
6+
WORKDIR /app
7+
RUN npm install
8+
9+
COPY ui/ /app/
10+
RUN npm run build
11+
12+
FROM python:3.12
13+
14+
RUN pip install -U pip && pip install gunicorn --no-cache-dir
15+
16+
COPY pyproject.toml /app/
17+
COPY splinter/__init__.py /app/splinter/
18+
RUN pip install -e /app --no-cache-dir
19+
20+
WORKDIR /app
21+
COPY splinter /app/splinter
22+
RUN splinter collectstatic --no-input
23+
24+
COPY --from=node /app/dist/ /app/ui
25+
CMD ["gunicorn", "--name=splinter", "splinter.wsgi:application", "--bind=0.0.0.0:8000"]

.github/workflows/ci.yml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
branches:
44
- main
55

6+
env:
7+
REGISTRY: ghcr.io
8+
IMAGE_NAME: ${{ github.repository }}
9+
610
jobs:
711
publish:
812
runs-on: ubuntu-latest
@@ -24,24 +28,23 @@ jobs:
2428
- name: Login to GitHub Container Registry
2529
uses: docker/login-action@v3
2630
with:
27-
registry: ghcr.io
31+
registry: ${{ env.REGISTRY }}
2832
username: ${{ github.actor }}
2933
password: ${{ secrets.GITHUB_TOKEN }}
3034

31-
- name: Build and push backend image
32-
uses: docker/build-push-action@v6
35+
- name: Extract Docker metadata
36+
id: meta
37+
uses: docker/metadata-action@v5
3338
with:
34-
context: .
35-
push: true
36-
tags: dsquare-io/splinter:latest
37-
cache-from: type=gha
38-
cache-to: type=gha,mode=max
39+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3940

40-
- name: Build and push frontend image
41+
- name: Build and push image
4142
uses: docker/build-push-action@v6
4243
with:
43-
context: ui
44-
push: true
45-
tags: dsquare-io/splinter:ui-latest
44+
context: .
45+
file: .github/Dockerfile
46+
push: ${{ github.event_name != 'pull_request' }}
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}
4649
cache-from: type=gha
4750
cache-to: type=gha,mode=max

Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
FROM python:3.12
22

3-
RUN pip install -U pip && pip install gunicorn --no-cache-dir
4-
53
COPY pyproject.toml /app/
64
COPY splinter/__init__.py /app/splinter/
75
RUN pip install -e /app --no-cache-dir

ui/Dockerfile

Lines changed: 0 additions & 14 deletions
This file was deleted.

ui/nginx.conf

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)