-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task/docker improvements #69
Open
haeser
wants to merge
9
commits into
eu-digital-identity-wallet:main
Choose a base branch
from
haeser:task/docker-improvements
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c7fd493
Use slimmer python based image
haeser d6891f5
Add non privileged user
haeser 3d10c64
Install cargo
haeser 8a0b6e4
Add entrypoint script over non-readable command
haeser 9529f37
Allow for custom secrets config mount, also expose the other configur…
haeser 4f440ad
Copy secret from mount to app config
haeser 8f96f22
Allow for metadata_config overwrites as per configuration documentation
haeser df8c1ca
Update documentation to include the metadata_config mount
haeser 196388b
Add missing chown
haeser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,50 @@ | ||
FROM ubuntu:22.04 | ||
FROM python:3.10-slim-bullseye | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
python3.10 \ | ||
python3.10-venv \ | ||
python3.10-dev \ | ||
python3-pip \ | ||
git \ | ||
gcc \ | ||
build-essential \ | ||
libssl-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Add a non root user for the application to run on | ||
RUN groupadd -r flaskuser && useradd -r -g flaskuser flaskuser | ||
|
||
RUN mkdir -p /home/flaskuser/eudi-srv-web-issuing-eudiw-py \ | ||
&& chown -R flaskuser:flaskuser /home/flaskuser | ||
|
||
RUN mkdir -p /tmp/log_dev | ||
RUN chmod -R 755 /tmp/log_dev | ||
RUN chown flaskuser:flaskuser /tmp/log_dev | ||
|
||
RUN git clone https://github.com/eu-digital-identity-wallet/eudi-srv-web-issuing-eudiw-py.git /root/eudi-srv-web-issuing-eudiw-py | ||
USER flaskuser | ||
|
||
WORKDIR /root/eudi-srv-web-issuing-eudiw-py | ||
# install cargo into user land | ||
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
ENV PATH="/home/flaskuser/.cargo/bin:${PATH}" | ||
|
||
RUN python3 -m venv venv | ||
# copy application contents into container | ||
WORKDIR /home/flaskuser/eudi-srv-web-issuing-eudiw-py | ||
COPY --chown=flaskuser:flaskuser ./app /home/flaskuser/eudi-srv-web-issuing-eudiw-py/app | ||
|
||
RUN /root/eudi-srv-web-issuing-eudiw-py/venv/bin/pip install --no-cache-dir -r app/requirements.txt | ||
RUN python3 -m venv venv | ||
RUN ./venv/bin/pip install --no-cache-dir -r app/requirements.txt | ||
|
||
EXPOSE 5000 | ||
|
||
ENV FLASK_APP=app\ | ||
FLASK_RUN_PORT=5000\ | ||
FLASK_RUN_HOST=0.0.0.0\ | ||
ENV FLASK_APP=app \ | ||
FLASK_RUN_PORT=5000 \ | ||
FLASK_RUN_HOST=0.0.0.0 \ | ||
SERVICE_URL="https://127.0.0.1:5000/" \ | ||
EIDAS_NODE_URL="https://preprod.issuer.eudiw.dev/EidasNode/"\ | ||
DYNAMIC_PRESENTATION_URL="https://dev.verifier-backend.eudiw.dev/ui/presentations/" | ||
EIDAS_NODE_URL="https://preprod.issuer.eudiw.dev/EidasNode/" \ | ||
DYNAMIC_PRESENTATION_URL="https://dev.verifier-backend.eudiw.dev/ui/presentations/" \ | ||
SECRETS_CONFIG_DIR="/home/flaskuser/secrets" \ | ||
METADATA_CONFIG_DIR="/home/flaskuser/metadata_config" | ||
|
||
# copy entrypoint script to conntainer | ||
COPY --chown=flaskuser:flaskuser docker/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
RUN chmod +x /usr/local/bin/entrypoint.sh | ||
|
||
CMD ["sh", "-c", "cp /root/secrets/config_secrets.py /root/eudi-srv-web-issuing-eudiw-py/app/app_config/ && export REQUESTS_CA_BUNDLE=/root/secrets/cert.pem && /root/eudi-srv-web-issuing-eudiw-py/venv/bin/flask run --cert=/root/secrets/cert.pem --key=/root/secrets/key.pem"] | ||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
|
||
if [ ! -f "$SECRETS_CONFIG_DIR/config_secrets.py" ]; then | ||
echo "Error: config_secrets.py not found in $SECRETS_CONFIG_DIR. Exiting." | ||
exit 1 | ||
fi | ||
|
||
cp "$SECRETS_CONFIG_DIR/config_secrets.py" /home/flaskuser/eudi-srv-web-issuing-eudiw-py/app/app_config/ | ||
|
||
if [ -d "$METADATA_CONFIG_DIR" ]; then | ||
cp "$METADATA_CONFIG_DIR/metadata_config.json" /home/flaskuser/eudi-srv-web-issuing-eudiw-py/app/metadata_config/ | ||
cp "$METADATA_CONFIG_DIR/openid-configuration.json" /home/flaskuser/eudi-srv-web-issuing-eudiw-py/app/metadata_config/ | ||
fi | ||
|
||
FLASK_RUN_CMD="./venv/bin/flask run" | ||
|
||
if [ -f "$SECRETS_CONFIG_DIR/cert.pem" ] && [ -f "$SECRETS_CONFIG_DIR/key.pem" ]; then | ||
export REQUESTS_CA_BUNDLE="$SECRETS_CONFIG_DIR/cert.pem" | ||
FLASK_RUN_CMD="$FLASK_RUN_CMD --cert=$SECRETS_CONFIG_DIR/cert.pem --key=$SECRETS_CONFIG_DIR/key.pem" | ||
else | ||
echo "No SSL certificate and key provided, running Flask without SSL." | ||
fi | ||
|
||
eval $FLASK_RUN_CMD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could not get it to work with
bookworm
. I'm always gettingoscrypto.errors.LibraryNotFoundError: Error detecting the version of libcrypto
even thoughlibssl-dev
is installed and openssl is working.