Skip to content

Commit

Permalink
added auto build and publish docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeimonakhov committed Apr 25, 2021
1 parent af5036b commit 2b47667
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build_and_push_docker_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Publish Docker image
on:
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Push to Docker Hub
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: puzlcloud/example-sanic-server
tag_with_ref: true
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
FROM python:3.8-slim

LABEL [email protected] \
vendor=puzl.ee

ENV USER=ubuntu \
UID=1000 \
GID=1000

SHELL ["/bin/bash", "-c"]

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ARG TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /usr/local/bin/tini

RUN addgroup --gid "$GID" "$USER" \
&& adduser \
--disabled-password \
--gecos "" \
--ingroup "$USER" \
--uid "$UID" \
--shell /bin/bash \
"$USER"

COPY . /usr/src/app/

WORKDIR /usr/src/app/

RUN python3 -m pip install -r requirements.txt \
&& chown $USER:$USER /usr/src/app \
&& chmod +x /usr/local/bin/*

RUN apt-get remove -y \
build-essential \
&& apt-get clean \
&& apt-get autoclean -y \
&& apt-get autoremove -y \
&& rm -rf \
/var/cache/debconf \
/tmp/*

USER $UID

EXPOSE 1616

ENTRYPOINT ["/usr/local/bin/tini", "--"]
CMD ["python3", "app.py"]

0 comments on commit 2b47667

Please sign in to comment.