This commit is contained in:
doman 2023-07-30 00:10:33 +02:00
parent 43dd4a8543
commit fa9a0569fb
2 changed files with 49 additions and 0 deletions

38
Dockerfile Normal file
View file

@ -0,0 +1,38 @@
# BUILD
FROM debian:stable-slim AS build-env
RUN apt-get update && apt-get install -yq curl file git unzip xz-utils zip && rm -rf /var/lib/apt/lists/*
RUN useradd -m flutter
RUN groupadd flutterusers
RUN usermod -aG flutterusers flutter
RUN mkdir /opt/flutter && chown -R flutter:flutter /opt/flutter
USER flutter
WORKDIR /home/flutter
RUN git clone https://github.com/flutter/flutter.git /opt/flutter
ENV PATH $PATH:/opt/flutter/bin
RUN flutter config --no-analytics --enable-web --no-enable-android --no-enable-ios
RUN flutter precache --web
RUN flutter create --platforms web dummy && rm -rf dummy
COPY . /home/flutter
USER root
RUN chown -R flutter:flutter /home/flutter
USER flutter
WORKDIR /home/flutter
RUN flutter build web
# DEPLOY
FROM node:16.14-alpine
COPY --from=build-env /home/flutter/build/web /app/
WORKDIR /app/
RUN apk --no-cache add curl
RUN npm install --global http-server
EXPOSE 80
CMD ["npx", "http-server", "-p", "80"]

11
docker-compose.yml Normal file
View file

@ -0,0 +1,11 @@
version: '3'
services:
app:
restart: unless-stopped
image: app
build:
dockerfile: Dockerfile
context: .
ports:
- "8000:80"