diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 0784be46..bb8f00e5 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -46,7 +46,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@eafaea8d0f5853934deece2ffa67af59d936562b with: - context: ./${{ matrix.service }} + context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} file: ./${{ matrix.service }}/Dockerfile diff --git a/api/Dockerfile b/api/Dockerfile index 19f7859c..151eb01b 100644 --- a/api/Dockerfile +++ b/api/Dockerfile @@ -2,18 +2,16 @@ FROM node:current as builder WORKDIR /build -# Add Web Files +# Add Files ADD . . -ADD package.json . -ADD yarn.lock . # Build -RUN yarn install && yarn build +RUN yarn install && yarn workspace api build FROM node:current WORKDIR /app -COPY --from=builder /build/dist /app +COPY --from=builder /build/api/dist /app CMD [ "node", "main.js" ] \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 5743621c..41c12cae 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -1,16 +1,14 @@ -FROM node:current as web_builder +FROM node:current as builder WORKDIR /build -# Add Web Files +# Add Files ADD . . -ADD package.json . -ADD yarn.lock . # Build -RUN yarn install && yarn build +RUN yarn install && yarn workspace frontend build FROM docker.io/nginx:1-alpine -COPY --from=web_builder /build/dist /usr/share/nginx/html +COPY --from=builder /build/frontend/dist /usr/share/nginx/html ADD nginx.conf /etc/nginx/nginx.conf \ No newline at end of file