Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ubs-form into main
  • Loading branch information
simon-the-shark committed Aug 9, 2024
2 parents a6fea1b + 73a43ef commit 7176b04
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
API_URL="https://admin.topwr.solvro.pl/graphql"
ASSETS_URL="https://admin.topwr.solvro.pl/assets"
IPARKING_URL="https://iparking.pwr.edu.pl"
FIREBASE_NAME="CHANGE_ME"
FIREBASE_CLIENT_ID="CHANGE_ME"
FIREBASE_PRIVATE_KEY="CHANGE_ME"
FIREBASE_EMAIL="CHANGE_ME"
53 changes: 53 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Deploy

on:
push:
branches: ["main"]

env:
REGISTRY: ghcr.io

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Add envs
run: cp .env.example .env

- name: Add firebase config
run: |
echo "${{ secrets.FIREBASE_CONFIG }}" | base64 --decode > lib/firebase_options.dart
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ghcr.io/solvro/web-topwr-sci-clubs-form:latest
cache-from: type=registry,ref=ghcr.io/solvro/web-topwr-sci-clubs-form:latest
cache-to: type=inline
network: host

- name: Trigger build
run: |
curl --request GET '${{ secrets.COOLIFY_WEBHOOK }}' --header 'Authorization: Bearer ${{ secrets.COOLIFY_TOKEN }}'
14 changes: 8 additions & 6 deletions .github/workflows/lint_and_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ name: Lint & formatting

on:
push:
branches: ["**"]
pull_request:
branches: ["**"]

jobs:
build:
Expand All @@ -17,12 +15,16 @@ jobs:
flutter-version: "3.22.3"
channel: "stable"
- run: flutter --version

- name: Install dependencies
run: dart pub get

- name: Example .env
run: cp example.env .env
run: cp .env.example .env

- name: Add firebase config
run: |
echo "${{ secrets.FIREBASE_CONFIG }}" | base64 --decode > lib/firebase_options.dart
- name: generate files
run: dart run build_runner build --delete-conflicting-outputs
Expand All @@ -31,4 +33,4 @@ jobs:
run: dart format --output=none --set-exit-if-changed .

- name: Analyze project source
run: flutter analyze --fatal-infos
run: flutter analyze --fatal-infos
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ app.*.symbols
.env
*.env.dev
.env.dev
!.env.example
env.g.dart
**/env.g.dart

Expand Down
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Install Operating system and dependencies
FROM ubuntu:20.04 AS build

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback python3
RUN apt-get clean

ENV DEBIAN_FRONTEND=dialog

# download Flutter SDK from Flutter Github repo
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter

# Set flutter environment path
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"

# Run flutter doctor
RUN flutter doctor

# Enable flutter web
RUN flutter channel stable
RUN flutter upgrade
RUN flutter config --enable-web

# Copy files to container and build
RUN mkdir /app/
COPY . /app/
WORKDIR /app/
RUN dart run build_runner build -d
RUN flutter build web --web-renderer html

FROM socialengine/nginx-spa:latest
COPY --chown=nginx:nginx --from=build /app/build/web /app
EXPOSE 80
2 changes: 1 addition & 1 deletion lib/config/api_base_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ abstract class ApiBaseConfig {
path: ".env",
obfuscate: true,
useConstantCase: true,
requireEnvFile: true,
requireEnvFile: false,
)
abstract class ApiBaseEnv {
@EnviedField()
Expand Down

0 comments on commit 7176b04

Please sign in to comment.