Skip to content
Snippets Groups Projects

include TRANSLATIONS_DIR as environment variable in the Docker image

Merged Karel van Klink requested to merge feature/update-dockerfile into develop
2 files
+ 20
13
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 6
13
@@ -2,7+2,7 @@
WORKDIR /app
ARG ARTIFACT_VERSION
RUN apk add --no-cache gcc libc-dev libffi-dev && \
addgroup -S appgroup && adduser -S appuser -G appgroup -h /app
USER appuser
@@ -17,7+17,7 @@
# 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"]
Loading