diff --git a/.dockerignore b/.dockerignore index a9b826f7e..ae1b98f6f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,4 @@ build codegen var +webapp diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4ca0dd7ac..f6cd2fc74 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,12 +40,6 @@ jobs: - uses: actions/setup-go@v1 with: go-version: 1.16 - - uses: actions/cache@v2 - if: ${{ !env.ACT }} - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: ${{ runner.os }}-go- - run: make release-clean release - run: make upload if: ${{ !env.ACT }} @@ -91,7 +85,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - run: docker build -t cortezaproject/corteza-server:${{ env.BUILD_VERSION }} . + - run: docker build --build-arg "BUILD_VERSION=${BUILD_VERSION}" -t cortezaproject/corteza-server:${{ env.BUILD_VERSION }} . if: ${{ !env.ACT }} - run: docker push cortezaproject/corteza-server:${{ env.BUILD_VERSION }} if: ${{ !env.ACT }} diff --git a/Dockerfile b/Dockerfile index 1db632dcb..609d83608 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,3 @@ -# build stage -FROM golang:1.16-buster as build-stage - -ENV GOFLAGS='-mod=readonly' -ENV BUILD_OS=linux -ENV BUILD_ARCH=amd64 -ENV BUILD_VERSION=latest - -WORKDIR /corteza - -COPY . ./ - -RUN make release-clean release - - # deploy stage FROM ubuntu:20.04 @@ -22,21 +7,29 @@ RUN apt-get -y update \ curl \ && rm -rf /var/lib/apt/lists/* +ARG VERSION=2021.9.0 +ARG SERVER_VERSION=${VERSION} +ARG CORTEZA_SERVER_PATH=https://releases.cortezaproject.org/files/corteza-server-${SERVER_VERSION}-linux-amd64.tar.gz +RUN mkdir /tmp/server +ADD $CORTEZA_SERVER_PATH /tmp/server + +VOLUME /data + +RUN tar -zxvf "/tmp/server/$(basename $CORTEZA_SERVER_PATH)" -C / && \ + rm -rf "/tmp/server" && \ + mv /corteza-server /corteza + +WORKDIR /corteza + +HEALTHCHECK --interval=30s --start-period=1m --timeout=30s --retries=3 \ + CMD curl --silent --fail --fail-early http://127.0.0.1:80/healthcheck || exit 1 + ENV STORAGE_PATH "/data" ENV CORREDOR_ADDR "corredor:80" ENV HTTP_ADDR "0.0.0.0:80" ENV HTTP_WEBAPP_ENABLED "false" ENV PATH "/corteza/bin:${PATH}" -WORKDIR /corteza - -VOLUME /data - -COPY --from=build-stage /corteza/build/pkg/corteza-server ./ - -HEALTHCHECK --interval=30s --start-period=1m --timeout=30s --retries=3 \ - CMD curl --silent --fail --fail-early http://127.0.0.1:80/healthcheck || exit 1 - EXPOSE 80 ENTRYPOINT ["./bin/corteza-server"]