PromucFlow_constructor/Dockerfile
Shrikant Sharat Kandula 15824af382
chore: Fix condition syntax in Dockerfile (#37270)
## Description

The `&&` syntax for `and`-ing conditions doesn't work with `[`
**command**, it only works with `[[` **expressions**. But we can't use
`[[` expressions, since this isn't bash, it's `/bin/sh`. We can't use
bash, since doing so is throwing up a whole lot of other errors that
I've parked for another day, several months ago.

Instead of `&&`, we have to use `-a` when using the `[` command.

Currently, when building the Docker image, we see the following error:

```
#8 [3/6] RUN <<END (if ! [ -f info.json ]; then...)
#8 0.142 /bin/sh: 6: [: missing ]
#8 0.142 /bin/sh: 6: -f: not found
```

It doesn't seem to have an impact, but it _is_ an error nonetheless.

We're also refactoring to not add the executable permission twice, which
is redundant. We're only doing it once now.

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/11718707642>
> Commit: 6c739439fa181f41245294a46321544edf61e878
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11718707642&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Thu, 07 Nov 2024 09:18:50 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No

/test sanity


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Summary by CodeRabbit

- **Chores**
- Updated the Dockerfile to enhance file existence checks and manage
executable permissions for shell scripts.
- Removed unnecessary directory creation commands for `./editor` and
`./rts`.
- Maintained existing structure, including exposed ports and health
check commands.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
2024-11-07 15:36:30 +05:30

65 lines
1.8 KiB
Docker

ARG BASE
FROM ${BASE}
ENV IN_DOCKER=1
ARG APPSMITH_CLOUD_SERVICES_BASE_URL
ENV APPSMITH_CLOUD_SERVICES_BASE_URL=${APPSMITH_CLOUD_SERVICES_BASE_URL}
ARG APPSMITH_SEGMENT_CE_KEY
ENV APPSMITH_SEGMENT_CE_KEY=${APPSMITH_SEGMENT_CE_KEY}
COPY deploy/docker/fs /
RUN <<END
if ! [ -f info.json ]; then
echo "Missing info.json" >&2
exit 1
fi
if ! [ -f server/mongo/server.jar -a -f server/pg/server.jar ]; then
echo "Missing one or both server.jar files in the right place. Are you using the build script?" >&2
exit 1
fi
END
# Add client UI - Application Layer
COPY ./app/client/build editor/
# Add RTS - Application Layer
COPY ./app/client/packages/rts/dist rts/
ENV PATH /opt/bin:/opt/appsmith/utils/node_modules/.bin:/opt/java/bin:/opt/node/bin:$PATH
RUN <<END
set -o errexit
cd ./utils
npm install --only=prod
npm install --only=prod -g .
rm -rf utils/node_modules/resolve/test
cd -
# Make all `*.sh` files executable, excluding `node_modules`.
find . \( -name node_modules -prune \) -o \( -type f -name '*.sh' \) -exec chmod +x '{}' +
# Ensure all custom command-scripts have executable permission
chmod +x /opt/bin/* /watchtower-hooks/*.sh
# Disable setuid/setgid bits for the files inside container.
find / \( -path /proc -prune \) -o \( \( -perm -2000 -o -perm -4000 \) -exec chmod -s '{}' + \) || true
mkdir -p /.mongodb/mongosh /appsmith-stacks
chmod ugo+w /etc /appsmith-stacks
chmod -R ugo+w /var/run /.mongodb /etc/ssl /usr/local/share
END
LABEL com.centurylinklabs.watchtower.lifecycle.pre-check=/watchtower-hooks/pre-check.sh
LABEL com.centurylinklabs.watchtower.lifecycle.pre-update=/watchtower-hooks/pre-update.sh
EXPOSE 80
EXPOSE 443
ENTRYPOINT [ "/opt/appsmith/entrypoint.sh" ]
HEALTHCHECK --interval=15s --timeout=15s --start-period=45s CMD "/opt/appsmith/healthcheck.sh"
CMD ["/usr/bin/supervisord", "-n"]