Skip to content

Commit f8fc2b2

Browse files
committed
update dependencies and build
1 parent 4fa180f commit f8fc2b2

File tree

8 files changed

+3522
-12445
lines changed

8 files changed

+3522
-12445
lines changed

.github/workflows/deploy.yaml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,32 @@ on:
88

99
jobs:
1010
deploy:
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-24.04-arm
1212
steps:
1313
- name: Cloning repo
1414
uses: actions/checkout@v3
1515
with:
1616
fetch-depth: 0
1717

18-
- name: Push to dokku
19-
uses: dokku/github-action@master
18+
- name: Store package.json version
19+
run: |
20+
echo "placewaifu_version=$(jq -r '.version' web/package.json)" >> $GITHUB_ENV
21+
22+
- name: Login to GitHub Container Registry
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ghcr.io
26+
username: "${{ github.actor }}"
27+
password: "${{ secrets.GITHUB_TOKEN }}"
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@v3
30+
- name: Build and push container
31+
uses: docker/build-push-action@v6
2032
with:
21-
git_push_flags: "--force"
22-
git_remote_url: "ssh://dokku@${{ secrets.IP }}:22/placewaifu"
23-
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
33+
context: .
34+
file: Dockerfile
35+
platforms: linux/arm64
36+
push: true
37+
tags: |
38+
ghcr.io/xetera/placewaifu:${{ env.placewaifu_version }}
39+
ghcr.io/xetera/placewaifu:latest

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
dist-newstyle
33
.vscode
44

5-
web/.cache
5+
web/.parcel-cache
66
web/node_modules
77
web/dist

Dockerfile

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
1-
FROM haskell:9.2.7 as build
1+
FROM node:22.14-slim AS web
2+
3+
WORKDIR /app
4+
5+
COPY ./assets ./assets
6+
COPY ./web ./web
7+
8+
WORKDIR /app/web
9+
RUN apt-get clean && apt-get update && apt-get upgrade -y && apt-get install -y python3
10+
11+
RUN --mount=type=cache,id=npm,target=/root/.npm npm ci
12+
13+
RUN npm run build
14+
15+
FROM haskell:9.10-slim-bullseye AS build
216

317
WORKDIR /opt/server
4-
RUN apt-get clean && apt-get update
518

6-
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && apt-get install -y nodejs locales
19+
RUN cabal update
20+
RUN apt-get clean && apt-get update
21+
RUN apt-get install -y locales
722

823
RUN locale-gen en_US.UTF-8
9-
ENV LANG en_US.UTF-8
10-
ENV LANGUAGE en_US:en
11-
ENV LC_ALL en_US.UTF-8
24+
ENV LANG=en_US.UTF-8
25+
ENV LANGUAGE=en_US:en
26+
ENV LC_ALL=en_US.UTF-8
1227

13-
COPY package.yaml stack.yaml* ./
14-
# COPY .stack-work ./stack-work
15-
RUN stack build --resolver lts-20.17 --only-dependencies
28+
COPY package.yaml placewaifu.cabal ./
29+
RUN --mount=type=cache,id=cabal-deps,target=/root/.cabal cabal build --only-dependencies -j4
1630

1731
COPY ./ ./
18-
RUN stack install
19-
20-
RUN cd web && npm i && npm run build
32+
RUN --mount=type=cache,id=cabal,target=/root/.cabal cabal install
2133

2234
FROM ubuntu
2335

36+
COPY --from=web /app/web/dist ./web/dist
2437
COPY --from=build /root/.local/bin/placewaifu .
25-
COPY --from=build /opt/server/web/dist ./web/dist
2638
COPY ./assets ./assets
27-
CMD ./placewaifu --assets=./assets
39+
40+
USER nobody
41+
42+
EXPOSE 3000
43+
CMD ["./placewaifu", "--assets=./assets"]

deploy/manifests/deployment.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: placewaifu
5+
spec:
6+
selector:
7+
matchLabels:
8+
app: placewaifu
9+
template:
10+
metadata:
11+
labels:
12+
app: placewaifu
13+
spec:
14+
containers:
15+
- name: placewaifu
16+
image: ghcr.io/xetera/placewaifu:latest
17+
imagePullPolicy: Always
18+
resources:
19+
limits:
20+
memory: "128Mi"
21+
cpu: "100m"
22+
ports:
23+
- containerPort: 3000
24+
env:
25+
- name: OTEL_EXPORTER_OTLP_ENDPOINT
26+
value: "http://alloy.monitoring.svc.cluster.local:4318"
27+
- name: DATABASE_URL
28+
valueFrom:
29+
secretKeyRef:
30+
name: me-db-url
31+
key: DATABASE_URL
32+
volumeMounts:
33+
- name: me-config
34+
mountPath: /app/config.toml
35+
subPath: config.toml
36+
volumes:
37+
- name: me-config
38+
secret:
39+
secretName: me-config

0 commit comments

Comments
 (0)