Skip to content

Commit d208e83

Browse files
author
Kim Cuong
authored
Merge pull request #5 from 4pet-social/dockerize
Support CI / CD
2 parents 5e17a73 + 746e752 commit d208e83

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Test, Publish, & Release
2+
on: [push]
3+
jobs:
4+
publish:
5+
runs-on: ubuntu-latest
6+
if: startsWith(github.ref, 'refs/tags/')
7+
steps:
8+
- name: Set up QEMU
9+
uses: docker/setup-qemu-action@v1
10+
- name: Set up Docker Buildx
11+
uses: docker/setup-buildx-action@v1
12+
- name: Login to DockerHub
13+
uses: docker/login-action@v1
14+
with:
15+
username: ${{ secrets.DOCKERHUB_USERNAME }}
16+
password: ${{ secrets.DOCKERHUB_TOKEN }}
17+
- name: Build and push
18+
id: docker_build
19+
uses: docker/build-push-action@v2
20+
with:
21+
push: true
22+
tags: |
23+
4petsocial/landing-page:latest
24+
4petsocial/landing-page:0.7.0
25+
- name: Image digest
26+
run: echo ${{ steps.docker_build.outputs.digest }}
27+
create-release:
28+
needs: publish
29+
runs-on: ubuntu-latest
30+
if: startsWith(github.ref, 'refs/tags/')
31+
steps:
32+
- uses: actions/checkout@master
33+
- uses: Roang-zero1/github-create-release-action@master
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
36+
deployment:
37+
needs: publish
38+
runs-on: ubuntu-latest
39+
if: startsWith(github.ref, 'refs/tags/')
40+
steps:
41+
- name: executing remote ssh commands using password
42+
uses: appleboy/ssh-action@master
43+
with:
44+
host: ${{ secrets.HOST }}
45+
username: ${{ secrets.USERNAME }}
46+
key: ${{ secrets.KEY }}
47+
port: ${{ secrets.PORT }}
48+
script: cd deployment/prod-env && docker-compose pull && ./scripts/rebuild.sh

Dockerfile

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#Stage 1 - Install dependencies and build the app
2+
FROM debian:latest AS build-env
3+
4+
# Install flutter dependencies
5+
RUN apt-get update
6+
RUN apt-get install -y curl git wget unzip libgconf-2-4 gdb libstdc++6 libglu1-mesa fonts-droid-fallback lib32stdc++6 python3
7+
RUN apt-get clean
8+
9+
# Clone the flutter repo
10+
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
11+
12+
# Set flutter path
13+
# RUN /usr/local/flutter/bin/flutter doctor -v
14+
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:${PATH}"
15+
16+
# Run flutter doctor
17+
RUN flutter doctor -v
18+
# Enable flutter web
19+
RUN flutter channel master
20+
RUN flutter upgrade
21+
RUN flutter config --enable-web
22+
23+
# Copy files to container and build
24+
RUN mkdir /app/
25+
COPY . /app/
26+
WORKDIR /app/
27+
RUN flutter build web
28+
29+
# Stage 2 - Create the run-time image
30+
FROM nginx
31+
COPY --from=build-env /app/build/web /usr/share/nginx/html

0 commit comments

Comments
 (0)