Skip to content

Commit

Permalink
initial (#7737)
Browse files Browse the repository at this point in the history
Co-authored-by: Khanh Nguyen <[email protected]>
  • Loading branch information
btobin and khanhnwin authored Nov 10, 2022
1 parent 75a518d commit bd82da8
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 16,779 deletions.
27 changes: 9 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,58 +10,49 @@ RUN apt-get update && apt-get install -yq --no-install-recommends \
xdg-user-dirs \
&& rm -rf /var/lib/apt/lists/*

RUN echo "alias lla='ls -lAhG --color=auto'" >> ~/.bashrc
WORKDIR /app



# ============== INSTALL FLUTTER ==============
# TODO recommended to move to a SHA based install for security reasons
# NOTE that this will fail if you have not cloned the repo with --recurse-submodules
# or run `git submodule update --init --recursive` after cloning.
FROM base AS flutter

# TODO to avoid issues/clashes with the host repo, and to one day remove
# the flutter submodule in the host repo, test with clone. Only issue we need
# more information on is why the local version would ever be detached or pinned
# at a specific commit/hash???
# RUN git clone https://github.com/flutter/website.git

# This Flutter install uses/requires the local ./flutter submodule
COPY ./flutter ./flutter
COPY ./site-shared ./site-shared
COPY pubspec.yaml ./

ARG FLUTTER_BRANCH
ENV FLUTTER_BRANCH=$FLUTTER_BRANCH
ARG FLUTTER_BUILD_BRANCH
ENV FLUTTER_BUILD_BRANCH=$FLUTTER_BUILD_BRANCH
ENV FLUTTER_ROOT=flutter
ENV FLUTTER_BIN=flutter/bin
ENV PATH="/app/flutter/bin:$PATH"

# Used if wanting to build the container with a different branch, this
# would change the current branch of and update the mirrored submodule
# e.g. `make build FLUTTER_BRANCH=beta`
# e.g. `make build FLUTTER_BUILD_BRANCH=beta`
# This is not to be confused with the $FLUTTER_TEST_BRANCH
RUN if test -n "$FLUTTER_BRANCH" -a "$FLUTTER_BRANCH" != "stable" ; then \
RUN if test -n "$FLUTTER_BUILD_BRANCH" -a "$FLUTTER_BUILD_BRANCH" != "stable" ; then \
cd flutter && \
git fetch && \
git remote set-branches origin "$FLUTTER_BRANCH" && \
git fetch --depth 1 origin "$FLUTTER_BRANCH" && \
git checkout "$FLUTTER_BRANCH" -- && \
git remote set-branches origin "$FLUTTER_BUILD_BRANCH" && \
git fetch --depth 1 origin "$FLUTTER_BUILD_BRANCH" && \
git checkout "$FLUTTER_BUILD_BRANCH" -- && \
git pull; \
fi

# Set up Flutter
# NOTE You will get a warning "Woah! You appear to be trying to run flutter as root."
# and this is to be disregarded since this image is never deployed to production.
# It is not worth setting up a Docker user or mirroring host, but you may run into
# conflicts with the local host repo and the Docker one.
RUN flutter doctor
RUN flutter --version
RUN dart pub get



# ============== NODEJS INTSALL ==============
# TODO recommended to move to a SHA based install for security reasons
FROM flutter AS node

RUN curl -sL https://deb.nodesource.com/setup_18.x -o node_setup.sh && \
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ BUILD_CONFIGS ?= _config.yml
BUILD_NAME = tmpbuild
BUILD_TAG = "fltbuild:${BUILD_COMMIT}"
FIREBASE_ALIAS ?= default
FLUTTER_BRANCH ?= stable
FLUTTER_BUILD_BRANCH ?= stable
FLUTTER_TEST_BRANCH ?= stable
JEKYLL_SITE_HOST ?= 0.0.0.0
JEKYLL_SITE_PORT ?= 4002
Expand All @@ -33,7 +33,7 @@ STAGE_NAME ?= docs
.env:
touch $@
genenv: .env
@echo "FLUTTER_BRANCH=stable" >> $<
@echo "FLUTTER_BUILD_BRANCH=stable" >> $<
@echo "FIREBASE_ALIAS=default" >> $<
@echo "FIREBASE_TOKEN=" >> $<

Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ services:
environment:
- NODE_ENV=development
- JEKYLL_ENV=development
- FIREBASE_ALIAS=${FIREBASE_ALIAS:-default}
- FIREBASE_TOKEN=$FIREBASE_TOKEN
ports:
- "4002:4002"
- "35729:35729"
Expand Down
Loading

0 comments on commit bd82da8

Please sign in to comment.