Skip to content

Commit 23baf2e

Browse files
committed
make fly ready
1 parent 27a1ffb commit 23baf2e

File tree

8 files changed

+15824
-12355
lines changed

8 files changed

+15824
-12355
lines changed

.github/workflows/fly-deploy.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
2+
3+
name: Fly Deploy
4+
on:
5+
push:
6+
branches:
7+
- main
8+
jobs:
9+
deploy:
10+
name: Deploy app
11+
runs-on: ubuntu-latest
12+
concurrency: deploy-group # optional: ensure only one action runs at a time
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: superfly/flyctl-actions/setup-flyctl@master
16+
- run: flyctl deploy --remote-only
17+
env:
18+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

Dockerfile

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1+
FROM node:22.6.0 as node
2+
3+
WORKDIR /app/ui
4+
COPY ui/package-lock.json ./package-lock.json
5+
COPY ui/package.json ./package.json
6+
RUN npm ci
7+
8+
COPY ui /app/ui
9+
RUN npm run build
10+
11+
FROM golang:1.23 as api
12+
13+
WORKDIR /app
14+
COPY api/go.mod api/go.sum ./
15+
RUN go mod download
16+
COPY api /app
17+
RUN CGO_ENABLED=0 go build
18+
119
FROM alpine:3.7
220

3-
COPY api/api /api
4-
COPY ui/build /ui/build
21+
COPY --from=api /app/api /api
22+
COPY --from=node /app/ui/build /ui/build
523

624
RUN chmod +x /api
725

Makefile

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
REGISTRY=docker.pkg.github.com/elwin
22
VERSION=latest
33

4-
build-ui:
5-
cd ui; npm run build;
6-
7-
build-api:
8-
cd api; GOOS=linux GOARCH=amd64 go build;
9-
10-
build: build-api build-ui
4+
build:
115
docker build . -t chat
126

137
publish: build
148
docker tag chat $(REGISTRY)/chat/chat:$(VERSION)
159
docker push $(REGISTRY)/chat/chat:$(VERSION)
10+
11+
run: build
12+
docker run -p 8888:8888 chat

fly.toml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# fly.toml app configuration file generated for chat-ws on 2024-08-16T09:31:12+02:00
2+
#
3+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+
#
5+
6+
app = 'chat-ws'
7+
primary_region = 'ams'
8+
9+
[build]
10+
11+
[http_service]
12+
internal_port = 8888
13+
force_https = true
14+
auto_stop_machines = 'suspend'
15+
auto_start_machines = true
16+
min_machines_running = 0
17+
processes = ['app']
18+
19+
[[http_service.checks]]
20+
grace_period = "10s"
21+
interval = "30s"
22+
method = "GET"
23+
timeout = "5s"
24+
path = "/"
25+
26+
[[vm]]
27+
memory = '512mb'
28+
cpu_kind = 'shared'
29+
cpus = 1

package-lock.json

-3
This file was deleted.

0 commit comments

Comments
 (0)