Skip to content

Commit

Permalink
fix docker build (#769)
Browse files Browse the repository at this point in the history
* fix docker build

* fix docker build

* fix docker build

* add EXPOSE to Dockerfile and edit selfhosting file

---------

Co-authored-by: Simon Rieger <[email protected]>
  • Loading branch information
simono41 and Simon Rieger authored Dec 18, 2024
1 parent e8c44f5 commit 6ce4742
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
20 changes: 12 additions & 8 deletions app/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Install Operating system and dependencies
FROM ubuntu:22.04 AS builder
FROM ubuntu:24.04 AS builder

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

RUN mkdir /app/
COPY . /app
WORKDIR /app
RUN mkdir /flutter_app/
COPY . /flutter_app
WORKDIR /flutter_app/app

# download Flutter SDK from Flutter Github repo
RUN git clone https://github.com/flutter/flutter.git -b $(cat /FLUTTER_VERSION) /usr/local/flutter
RUN git clone https://github.com/flutter/flutter.git -b $(yq '.environment.flutter' /flutter_app/app/pubspec.yaml -r) /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

Expand All @@ -21,8 +23,10 @@ RUN flutter config --enable-web
# Copy files to container and build
RUN flutter build web

# Nginx Container
FROM nginx:alpine

RUN mkdir /app/
EXPOSE 80

# Copy build/web in container to /app/
COPY --from=builder ./build/web /usr/share/nginx/html
COPY --from=builder /flutter_app/app/build/web /usr/share/nginx/html
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
butterfly:
build:
context: .
container_name: butterfly
#ports:
# - "3000:80"
restart: always
2 changes: 1 addition & 1 deletion docs/src/content/docs/downloads/selfhosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ All the files are in the `app/build/web` directory.
## Docker

Clone the repository and build the `Dockerfile` using: `docker build -t linwood-butterfly`.
Start the server using: `docker run -p 8080:8080 -d linwood-butterfly`.
Start the server using: `docker run -p 8080:80 -d linwood-butterfly`.

0 comments on commit 6ce4742

Please sign in to comment.