This commit is contained in:
@@ -14,8 +14,12 @@ COPY ./strapi/package.json ./strapi/package-lock.json ./
|
||||
# Install all dependencies (including devDependencies)
|
||||
RUN npm ci
|
||||
|
||||
# Copy the rest of the Strapi app
|
||||
COPY ./strapi ./
|
||||
# Copy the rest of the Strapi app to a template directory
|
||||
COPY ./strapi /opt/app-template
|
||||
|
||||
# Copy entrypoint script
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENV DATABASE_CLIENT=postgres
|
||||
ENV DATABASE_NAME=strapi
|
||||
@@ -34,4 +38,5 @@ ENV ALLOWED_HOSTS=localhost
|
||||
|
||||
EXPOSE 1337
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["npm", "run", "develop"]
|
||||
|
||||
@@ -19,6 +19,8 @@ services:
|
||||
- "1337:1337"
|
||||
depends_on:
|
||||
- postgres
|
||||
volumes:
|
||||
- ./data/strapi-app:/opt/app
|
||||
|
||||
postgres:
|
||||
image: postgres
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# If /opt/app/package.json does not exist, copy the app skeleton into /opt/app
|
||||
if [ ! -f /opt/app/package.json ]; then
|
||||
echo "Initializing /opt/app with application files..."
|
||||
cp -R /opt/app-template/* /opt/app/
|
||||
cp -R /opt/app-template/.[!.]* /opt/app/ 2>/dev/null || true
|
||||
fi
|
||||
|
||||
cd /opt/app
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user