Skip to content

Commit f76c046

Browse files
committed
[WIP] CI test
1 parent c326270 commit f76c046

File tree

3 files changed

+137
-2
lines changed

3 files changed

+137
-2
lines changed

.github/workflows/docker.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: "Build & Push Docker"
2+
3+
on:
4+
push:
5+
branches:
6+
- tf/docker-ci-test # Testing
7+
- next # Next, tags as "next"
8+
- master # Edge, tags as "edge"
9+
- release # Production, tags as "latest"
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref_name }}
13+
cancel-in-progress: true
14+
15+
env:
16+
REGISTRY: ghcr.io
17+
IMAGE_NAME: ${{ github.repository }}
18+
MANAGED_REGISTRY: registry.digitalocean.com/manifold
19+
20+
jobs:
21+
build-api:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
packages: write
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
- name: Login GHCR
30+
uses: docker/login-action@v4
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
- name: Login DOCR
36+
uses: docker/login-action@v4
37+
with:
38+
registry: registry.digitalocean.com/manifold
39+
username: docr
40+
password: ${{ secrets.DOCR_TOKEN }}
41+
- name: Docker meta
42+
id: meta
43+
uses: docker/metadata-action@v5
44+
with:
45+
images: |
46+
ghcr.io/ManifoldScholar/manifold-api
47+
registry.digitalocean.com/manifold/manifold-api
48+
tags: |
49+
type=raw,value=latest,enable=${{ github.ref_name == 'release' }}
50+
type=raw,value=edge,enable={{ is_default_branch }}
51+
type=ref,event=branch
52+
type=sha
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@v3
55+
- name: Build and push Docker
56+
id: push
57+
uses: docker/build-push-action@v5
58+
with:
59+
context: ./api
60+
target: production
61+
push: true
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max
64+
tags: ${{ steps.meta.outputs.tags }}
65+
labels: ${{ steps.meta.outputs.labels }}
66+
build-args:
67+
"RAILS_ENV=production"
68+
69+
build-client:
70+
runs-on: ubuntu-latest
71+
permissions:
72+
contents: read
73+
packages: write
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
- name: Login GHCR
78+
uses: docker/login-action@v4
79+
with:
80+
registry: ${{ env.REGISTRY }}
81+
username: ${{ github.actor }}
82+
password: ${{ secrets.GITHUB_TOKEN }}
83+
- name: Login DOCR
84+
uses: docker/login-action@v4
85+
with:
86+
registry: ${{ env.MANAGED_REGISTRY }}
87+
username: docr
88+
password: ${{ secrets.DOCR_TOKEN }}
89+
- name: Docker meta
90+
id: meta
91+
uses: docker/metadata-action@v5
92+
with:
93+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-client
94+
tags: |
95+
type=raw,value=latest,enable=${{ github.ref_name == 'release' }}
96+
type=raw,value=edge,enable={{ is_default_branch }}
97+
type=ref,event=branch
98+
type=sha
99+
- name: Set up Docker Buildx
100+
uses: docker/setup-buildx-action@v3
101+
- name: Build and push Docker
102+
id: push
103+
uses: docker/build-push-action@v5
104+
with:
105+
context: ./client
106+
target: production
107+
push: true
108+
cache-from: type=gha
109+
cache-to: type=gha,mode=max
110+
tags: ${{ steps.meta.outputs.tags }}
111+
labels: ${{ steps.meta.outputs.labels }}
112+
build-args:
113+
"RAILS_ENV=production"

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Production Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
build:
8+
name: Update Release Branch
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: "checkout release-candidate"
12+
uses: actions/checkout@v4
13+
with:
14+
ref: release
15+
16+
- name: "Push release changes"
17+
env:
18+
GH_TOKEN: ${{ github.token }}
19+
run: |
20+
git fetch
21+
git reset --hard origin/master
22+
git push --force origin release

client/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ COPY ./ /srv/app
55

66
RUN yarn
77

8-
FROM base AS dev
8+
FROM base AS development
99

1010
RUN yarn build:dev
1111

1212
EXPOSE 3010 3011 3012
1313

1414
CMD ["yarn", "run", "watch"]
1515

16-
FROM base AS prod
16+
FROM base AS production
1717

1818
RUN yarn build:prod
1919

0 commit comments

Comments
 (0)