Skip to content
Snippets Groups Projects
Commit d483ea74 authored by Karel van Klink's avatar Karel van Klink :smiley_cat:
Browse files

apply some more common practices for Dockerfiles

parent dbf7063f
Branches
Tags
1 merge request!90include TRANSLATIONS_DIR as environment variable in the Docker image
This commit is part of merge request !90. Comments created here will be created in the context of that merge request.
FROM python:3.11-alpine
WORKDIR /app
ARG ARTIFACT_VERSION
RUN apk add gcc libc-dev libffi-dev
RUN apk add --no-cache gcc libc-dev libffi-dev && \
addgroup -S appgroup && adduser -S appuser -G appgroup -h /app
USER appuser
RUN pip install \
--pre \
--extra-index-url https://artifactory.software.geant.org/artifactory/api/pypi/geant-swd-pypi/simple \
--target /app \
geant-service-orchestrator==${ARTIFACT_VERSION}
WORKDIR /app
# Create the directory for the configuration and copy the example config into it
# NOTE: a real config must be mounted at /etc/gso/config.json when running the container
RUN mkdir -p /etc/gso
COPY gso/oss-params-example.json /etc/gso/config.json
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
......@@ -27,7 +30,8 @@ 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 rm -rf gso/migrations && \
mv gso/migrations_temp gso/migrations
RUN PYTHONPATH=. python gso/main.py db upgrade heads
# Start the FastAPI application
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment