Skip to content

Commit

Permalink
Add Fly config
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelsvartveit committed Sep 14, 2024
1 parent 083620d commit 40dfad9
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# flyctl launch added from .gitignore
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
**/*.exe
**/*.exe~
**/*.dll
**/*.so
**/*.dylib

# Test binary, built with `go test -c`
**/*.test

# Output of the go coverage tool, specifically when used with LiteIDE
**/*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
**/go.work
**/go.work.sum

# env file
**/.env

**/tmp
**/data
**/node_modules

# flyctl launch added from node_modules/.pnpm/[email protected]/node_modules/tailwindcss/stubs/.gitignore
!node_modules/.pnpm/[email protected]/node_modules/tailwindcss/stubs/**/*
fly.toml
18 changes: 18 additions & 0 deletions .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

name: Fly Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
ARG GO_VERSION=1

# Build stage
FROM golang:${GO_VERSION}-alpine as builder

WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN CGO_ENABLED=1 go build -v -o ./main ./src


# Production stage
FROM alpine:latest

RUN apk --no-cache add ca-certificates

COPY --from=builder /app/main /main
COPY --from=builder /app/templates /templates
COPY --from=builder /app/static /static

CMD ["./main"]
29 changes: 29 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# fly.toml app configuration file generated for filtrert on 2024-09-14T16:59:40+02:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'filtrert'
primary_region = 'arn'

[build]
[build.args]
GO_VERSION = '1.23.0'

[env]
PORT = '8080'

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0
processes = ['app']

[[vm]]
size = 'shared-cpu-1x'

[mounts]
source = 'data'
destination = '/data'

0 comments on commit 40dfad9

Please sign in to comment.