Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
F
fetch-redir
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
fetch-redir
Commits
e084b24b
Commit
e084b24b
authored
Jul 21, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
first
parents
Pipeline
#39282
failed with stages
in 42 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
119 additions
and
0 deletions
+119
-0
.dockerignore
.dockerignore
+11
-0
.gitignore
.gitignore
+7
-0
.gitlab-ci.yml
.gitlab-ci.yml
+51
-0
Dockerfile
Dockerfile
+10
-0
main.py
main.py
+40
-0
No files found.
.dockerignore
0 → 100644
View file @
e084b24b
__pycache__
*.pyc
*.pyo
venv
*.http
.venv
.idea
.git*
Dockerfile
.dockerignore
.gitignore
0 → 100644
View file @
e084b24b
__pycache__
*.pyc
*.pyo
venv
*.http
.idea
\ No newline at end of file
.gitlab-ci.yml
0 → 100644
View file @
e084b24b
stages
:
-
build
-
deploy
variables
:
GIT_DEPTH
:
"
1"
before_script
:
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
.build-image
:
stage
:
build
script
:
-
docker build --pull -t $TARGET_IMAGE .
-
docker push $TARGET_IMAGE
build-x86
:
extends
:
.build-image
tags
:
-
docker
variables
:
TARGET_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86
build-arm
:
extends
:
.build-image
tags
:
-
docker-arm
variables
:
TARGET_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm
.deploy
:
stage
:
deploy
tags
:
-
docker
script
:
-
docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86
-
docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm
-
docker manifest create $TARGET_IMAGE --amend $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86 --amend
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm
-
docker manifest push $TARGET_IMAGE
deploy_latest
:
extends
:
.deploy
variables
:
TARGET_IMAGE
:
$CI_REGISTRY_IMAGE:latest
only
:
-
master
deploy_branch
:
extends
:
.deploy
variables
:
TARGET_IMAGE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
Dockerfile
0 → 100644
View file @
e084b24b
FROM
python:3.10
WORKDIR
/app
COPY
./requirements.txt ./
RUN
pip
install
--no-cache
-r
./requirements.txt
COPY
. ./
ENTRYPOINT
["python"]
CMD
["main.py"]
main.py
0 → 100644
View file @
e084b24b
import
os
from
fastapi
import
FastAPI
,
HTTPException
from
fastapi.responses
import
RedirectResponse
import
httpx
from
starlette.middleware.cors
import
CORSMiddleware
app
=
FastAPI
()
app
.
add_middleware
(
CORSMiddleware
,
allow_origins
=
[
"*"
],
allow_credentials
=
True
,
allow_methods
=
[
"*"
],
allow_headers
=
[
"*"
],
)
@
app
.
get
(
"/{route}"
)
async
def
redirect_route
(
route
:
str
):
env_key
=
f
"ROUTE_{route}"
target_url
=
os
.
getenv
(
env_key
)
if
not
target_url
:
raise
HTTPException
(
status_code
=
404
,
detail
=
f
"Route {env_key} not found."
)
try
:
async
with
httpx
.
AsyncClient
()
as
client
:
response
=
await
client
.
get
(
target_url
)
response
.
raise_for_status
()
redirect_link
=
response
.
text
.
strip
()
except
Exception
as
e
:
raise
HTTPException
(
status_code
=
501
,
detail
=
f
"Failed to retrieve redirect link: {str(e)}"
)
return
RedirectResponse
(
url
=
redirect_link
,
status_code
=
301
)
if
__name__
==
"__main__"
:
import
uvicorn
uvicorn
.
run
(
app
,
proxy_headers
=
True
,
host
=
"0.0.0.0"
,
port
=
3000
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment