diff --git a/Dockerfile b/Dockerfile
index 07825fab8c4c57ddbb25cc06aa679cc15ff2a0ed..36e5af274cc310344c5bf595838366b46652405b 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -17,22 +17,15 @@ RUN pip install \
 # NOTE: a real config must be mounted at /etc/gso/config.json when running the container
 RUN mkdir -p /etc/gso && \
     chown -R appuser:appgroup /etc/gso
-COPY --chown=appuser:appgroup gso/oss-params-example.json /etc/gso/config.json
-
-# Expose port 8080 for the FastAPI application
-EXPOSE 8080
+COPY --chown=appuser:appgroup gso/oss-params-example.json /app/config.json
 
 # The app reads the configuration from this location.
 # No need to set environment variables in your docker-compose.
-ENV OSS_PARAMS_FILENAME=/etc/gso/config.json
+ENV OSS_PARAMS_FILENAME=/app/config.json
 # Set the environment variable for the translations directory
 ENV TRANSLATIONS_DIR=/app/gso/translations/
-# Run database migrations
-RUN mv gso/migrations gso/migrations_temp
-RUN PYTHONPATH=. python gso/main.py db init
-RUN rm -rf gso/migrations && \
-    mv gso/migrations_temp gso/migrations
-RUN PYTHONPATH=. python gso/main.py db upgrade heads
 
-# Start the FastAPI application
-CMD ["python", "-m", "uvicorn", "gso.main:app", "--host", "0.0.0.0", "--port", "8080"]
+COPY --chown=appuser:appgroup --chmod=755 entrypoint.sh /app/entrypoint.sh
+
+EXPOSE 8080
+ENTRYPOINT ["/app/entrypoint.sh"]
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100755
index 0000000000000000000000000000000000000000..471f51da4f6478e215b7e869a7e160bd31d7d003
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# Run database migrations
+cd gso || exit 1
+mv migrations migrations_temp && \
+  PYTHONPATH=.. python main.py db init && \
+  rm -rf migrations && \
+  mv migrations_temp migrations
+
+PYTHONPATH=.. python main.py db upgrade heads
+
+# Start the FastAPI application
+cd ..
+python -m uvicorn "gso.main:app" --host "0.0.0.0" --port 8080