diff --git a/.github/workflows/sample_app.yaml b/.github/workflows/sample_app.yaml new file mode 100644 index 0000000..aaf1ed4 --- /dev/null +++ b/.github/workflows/sample_app.yaml @@ -0,0 +1,38 @@ +name: Sample App configuration +on: + push: + paths: + - 'example/apps/webapp/**' + +jobs: + irc: + runs-on: ubuntu-latest + name: Build sample app image + steps: + - name: checkout + id: checkout + uses: actions/checkout@v2 + with: + submodules: true + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: docker login + uses: docker/login-action@v1 + with: + username: ${{ secrets.PUBLIC_DOCKER_USERNAME }} + password: ${{ secrets.PUBLIC_DOCKER_PASSWORD }} + # always uses a single image ,the changes are overridden + # to-do versioning of the builds in case required + - name: build configurator + uses: docker/build-push-action@v2 + with: + tags: razorpay/devstack:webapp-latest + push: true + file: ./example/apps/webapp/Dockerfile diff --git a/.github/workflows/sample_app_devstack.yaml b/.github/workflows/sample_app_devstack.yaml new file mode 100644 index 0000000..27b5c9c --- /dev/null +++ b/.github/workflows/sample_app_devstack.yaml @@ -0,0 +1,38 @@ +name: Sample App devstack configuration +on: + push: + paths: + - 'example/apps/webapp/**' + +jobs: + irc: + runs-on: ubuntu-latest + name: Build sample app image + steps: + - name: checkout + id: checkout + uses: actions/checkout@v2 + with: + submodules: true + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + - name: docker login + uses: docker/login-action@v1 + with: + username: ${{ secrets.PUBLIC_DOCKER_USERNAME }} + password: ${{ secrets.PUBLIC_DOCKER_PASSWORD }} + # always uses a single image ,the changes are overridden + # to-do versioning of the builds in case required + - name: build configurator + uses: docker/build-push-action@v2 + with: + tags: razorpay/devstack:webapp-latest-devstack + push: true + file: ./example/apps/webapp/Dockerfile.devstack diff --git a/example/apps/webapp/Dockerfile b/example/apps/webapp/Dockerfile index 32a5506..4d488c0 100644 --- a/example/apps/webapp/Dockerfile +++ b/example/apps/webapp/Dockerfile @@ -1,6 +1,6 @@ FROM golang:1.16.8-alpine3.14 as builder RUN mkdir /build -ADD . /build/ +ADD ./example/apps/webapp /build/ WORKDIR /build RUN apk add build-base && go build -a -o crud-webapp . diff --git a/example/apps/webapp/Dockerfile.devstack b/example/apps/webapp/Dockerfile.devstack new file mode 100644 index 0000000..cd5062e --- /dev/null +++ b/example/apps/webapp/Dockerfile.devstack @@ -0,0 +1,13 @@ +FROM golang:1.16.8-alpine3.14 as builder +RUN mkdir /build +ADD ./example/apps/webapp /build/ +WORKDIR /build +RUN apk add build-base && go build -a -o crud-webapp . +#adds compile daemon for hot reloading +RUN go get github.com/githubnemo/CompileDaemon +# executable +EXPOSE 9090 + +ENTRYPOINT CompileDaemon -log-prefix=false --build="go build -a -o crud-webapp ." --command="./crud-webapp" + +CMD [ "./crud-webapp" ]