Skip to content

Commit

Permalink
Merge pull request #20 from Andmedoctopus/docker-container
Browse files Browse the repository at this point in the history
Add mocks3 in docker container
  • Loading branch information
Andmedoctopus committed Sep 12, 2023
2 parents 8c74bcd + 27d6026 commit 221636b
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dockerfile
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
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 }}
27 changes: 27 additions & 0 deletions Dockerfile
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

0 comments on commit 221636b

Please sign in to comment.