-
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.
Merge pull request #20 from Andmedoctopus/docker-container
Add mocks3 in docker container
- Loading branch information
Showing
3 changed files
with
69 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Dockerfile |
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,41 @@ | ||
name: docker package publish | ||
|
||
on: | ||
push: | ||
tags: | ||
"*.*" | ||
|
||
env: | ||
TARGET_PLATFORMS: linux/amd64,linux/arm64 | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-publish-docker-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
tags: ghcr.io/Shoobx/shoobx.mocks3:${{ github.ref_name }}, ghcr.io/Shoobx/shoobx.mocks3:latest | ||
platforms: ${{ env.TARGET_PLATFORMS }} |
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 @@ | ||
FROM python:3.11-bullseye | ||
|
||
LABEL org.opencontainers.image.authors="dev@shoobx.com" | ||
|
||
|
||
RUN apt-get update && \ | ||
apt-get upgrade -y &&\ | ||
rm -rf /var/lib/apt/lists/* /var/cache/apt/* | ||
|
||
ARG APP_USER=shoobx\ | ||
APP_GROUP=shoobx\ | ||
CODE_FOLDER=/shoobx/shoobx.mocks3 \ | ||
USER_ID=2000 \ | ||
GROUP_ID=2000 | ||
|
||
RUN groupadd --gid $GROUP_ID --non-unique $APP_GROUP && \ | ||
useradd --no-log-init --uid $USER_ID --non-unique --gid $GROUP_ID --create-home --shell /bin/bash $APP_USER && \ | ||
echo Created user $USER_ID and group $GROUP_ID | ||
|
||
WORKDIR $CODE_FOLDER | ||
|
||
COPY . . | ||
RUN pip install -r requirements.txt | ||
|
||
USER $APP_USER | ||
|
||
CMD sbx-mocks3-serve |