-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7fae4a2
commit 557d462
Showing
104 changed files
with
9,106 additions
and
332 deletions.
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,2 +1,8 @@ | ||
.build/ | ||
.swiftpm/ | ||
.git/ | ||
.github/ | ||
kubernetes/ | ||
docs/ | ||
README.md | ||
LICENSE |
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,11 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[yaml] | ||
indent_size = 2 |
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,9 +1,63 @@ | ||
Packages | ||
.build | ||
xcuserdata | ||
*.xcodeproj | ||
DerivedData/ | ||
__pycache__/ | ||
!default.mode1v3 | ||
!default.mode2v3 | ||
!default.pbxuser | ||
!default.perspectivev3 | ||
.accio/ | ||
.build/ | ||
.cache/ | ||
.coverage | ||
.dockerconfigjson | ||
.DS_Store | ||
db.sqlite | ||
.swiftpm | ||
.eggs/ | ||
.env | ||
.flaskenv | ||
.pytest_cache/ | ||
.python-version | ||
.swiftpm | ||
.tox/ | ||
.venv/ | ||
.workon | ||
*.dSYM | ||
*.dSYM.zip | ||
*.egg | ||
*.egg-info/ | ||
*.env | ||
*.hmap | ||
*.iml | ||
*.ipa | ||
*.mode1v3 | ||
*.mode2v3 | ||
*.moved-aside | ||
*.perspectivev3 | ||
*.pyc | ||
*.swp | ||
*.xccheckout | ||
*.xcodeproj | ||
*.xcscmblueprint | ||
/.mypy_cache/ | ||
build/ | ||
cover/ | ||
coverage.xml | ||
db.sqlite | ||
Dependencies/ | ||
DerivedData/ | ||
dist | ||
docs/_build | ||
env/ | ||
htmlcov | ||
junit-report.xml | ||
kubernetes/secrets/dev/tokens.txt | ||
MANIFEST | ||
newrelic.ini | ||
nosetests.xml | ||
Package.resolved | ||
Packages | ||
pylint.ini | ||
secrets.env | ||
src/configs/*.env | ||
t.py | ||
t2.py | ||
toy.py | ||
venv/ | ||
xcuserdata |
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,77 +1,69 @@ | ||
# ================================ | ||
# Build image | ||
# ================================ | ||
FROM swift:5.8-jammy as build | ||
|
||
# Install OS updates and, if needed, sqlite3 | ||
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ | ||
&& apt-get -q update \ | ||
&& apt-get -q dist-upgrade -y\ | ||
#------------------------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information. | ||
#------------------------------------------------------------------------------------------------------------- | ||
|
||
FROM python:3.10 | ||
|
||
# Avoid warnings by switching to noninteractive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
ENV PYTHONUNBUFFERED 1 | ||
|
||
# This Dockerfile adds a non-root 'vscode' user with sudo access. However, for Linux, | ||
# this user's GID/UID must match your local user UID/GID to avoid permission issues | ||
# with bind mounts. Update USER_UID / USER_GID if yours is not 1000. See | ||
# https://aka.ms/vscode-remote/containers/non-root-user for details. | ||
ARG USERNAME=sweetrpg | ||
ARG USER_UID=1001 | ||
ARG USER_GID=$USER_UID | ||
ARG REQUIREMENTS=requirements/deploy.txt | ||
ARG BUILD_NUMBER=unset | ||
ARG BUILD_JOB=unset | ||
ARG BUILD_SHA=unset | ||
ARG BUILD_DATE=unset | ||
ARG BUILD_VERSION=unset | ||
|
||
# Uncomment the following COPY line and the corresponding lines in the `RUN` command if you wish to | ||
# include your requirements in the image itself. It is suggested that you only do this if your | ||
# requirements rarely (if ever) change. | ||
COPY $REQUIREMENTS /tmp/pip-tmp/requirements.txt | ||
|
||
# Configure apt and install packages | ||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends apt-utils dialog 2>&1 \ | ||
# | ||
# Verify git, process tools, lsb-release (common in install instructions for CLIs) installed | ||
&& apt-get install -y git iproute2 procps lsb-release \ | ||
# | ||
# Install pylint | ||
&& pip install pylint \ | ||
# | ||
# Other stuff | ||
# && apt-get install -y postgresql-client | ||
# | ||
# Update Python environment based on requirements.txt | ||
&& pip --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \ | ||
&& rm -rf /tmp/pip-tmp \ | ||
# | ||
# Create a non-root user to use if preferred - see https://aka.ms/vscode-remote/containers/non-root-user. | ||
&& groupadd --gid $USER_GID $USERNAME \ | ||
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \ | ||
# | ||
# Clean up | ||
&& apt-get autoremove -y \ | ||
&& apt-get clean -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set up a build area | ||
WORKDIR /build | ||
|
||
# First just resolve dependencies. | ||
# This creates a cached layer that can be reused | ||
# as long as your Package.swift/Package.resolved | ||
# files do not change. | ||
COPY ./Package.* ./ | ||
RUN swift package resolve | ||
|
||
# Copy entire repo into container | ||
COPY . . | ||
|
||
# Build everything, with optimizations | ||
RUN swift build -c release --static-swift-stdlib | ||
|
||
# Switch to the staging area | ||
WORKDIR /staging | ||
|
||
# Copy main executable to staging area | ||
RUN cp "$(swift build --package-path /build -c release --show-bin-path)/App" ./ | ||
|
||
# Copy resources bundled by SPM to staging area | ||
RUN find -L "$(swift build --package-path /build -c release --show-bin-path)/" -regex '.*\.resources$' -exec cp -Ra {} ./ \; | ||
|
||
# Copy any resources from the public directory and views directory if the directories exist | ||
# Ensure that by default, neither the directory nor any of its contents are writable. | ||
RUN [ -d /build/Public ] && { mv /build/Public ./Public && chmod -R a-w ./Public; } || true | ||
RUN [ -d /build/Resources ] && { mv /build/Resources ./Resources && chmod -R a-w ./Resources; } || true | ||
|
||
# ================================ | ||
# Run image | ||
# ================================ | ||
FROM ubuntu:jammy | ||
|
||
# Make sure all system packages are up to date, and install only essential packages. | ||
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ | ||
&& apt-get -q update \ | ||
&& apt-get -q dist-upgrade -y \ | ||
&& apt-get -q install -y \ | ||
ca-certificates \ | ||
tzdata \ | ||
# If your app or its dependencies import FoundationNetworking, also install `libcurl4`. | ||
# libcurl4 \ | ||
# If your app or its dependencies import FoundationXML, also install `libxml2`. | ||
# libxml2 \ | ||
&& rm -r /var/lib/apt/lists/* | ||
|
||
# Create a vapor user and group with /app as its home directory | ||
RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app vapor | ||
|
||
# Switch to the new home directory | ||
COPY src /app | ||
ADD scripts/entrypoint.sh / | ||
RUN chown -R ${USER_UID}:${USER_GID} /app | ||
RUN echo "{\"number\":\"${BUILD_NUMBER}\",\"job\":\"${BUILD_JOB}\",\"sha\":\"${BUILD_SHA}\",\"date\":\"${BUILD_DATE}\",\"version\":\"${BUILD_VERSION}\"}" > /app/build-info.json | ||
WORKDIR /app | ||
|
||
# Copy built executable and any staged resources from builder | ||
COPY --from=build --chown=vapor:vapor /staging /app | ||
|
||
# Ensure all further commands run as the vapor user | ||
USER vapor:vapor | ||
# Switch back to dialog for any ad-hoc use of apt-get | ||
ENV DEBIAN_FRONTEND= | ||
|
||
# Let Docker bind to port 8080 | ||
EXPOSE 8080 | ||
USER ${USERNAME} | ||
|
||
# Start the Vapor service when the image is run, default to listening on 8080 in production environment | ||
ENTRYPOINT ["./App"] | ||
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"] | ||
ENTRYPOINT [ "/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,27 @@ | ||
.PHONY: docs | ||
init: | ||
pip install -r requirements/dev.txt | ||
test: | ||
# This runs all of the tests. | ||
detox | ||
ci: | ||
cd src && pytest ../tests --junitxml=report.xml | ||
|
||
test-readme: | ||
python setup.py check --restructuredtext --strict && ([ $$? -eq 0 ] && echo "README.rst and HISTORY.rst ok") || echo "Invalid markup in README.rst or HISTORY.rst!" | ||
|
||
flake8: | ||
flake8 --ignore=E501,F401,E128,E402,E731,F821 sweetrpg_catalog_api | ||
|
||
coverage: | ||
pytest --cov-config .coveragerc --verbose --cov-report term --cov-report xml --cov=sweetrpg_catalog_api tests | ||
|
||
publish: | ||
pip install 'twine>=1.5.0' | ||
python setup.py sdist bdist_wheel | ||
twine upload dist/* | ||
rm -fr build dist .egg sweetrpg_catalog_api.egg-info | ||
|
||
docs: | ||
cd docs && make html | ||
@echo "\033[95m\n\nBuild successful! View the docs homepage at docs/_build/html/index.html.\n\033[0m" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.