-
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.
added auto build and publish docker image
- Loading branch information
1 parent
af5036b
commit 2b47667
Showing
2 changed files
with
70 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,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 |
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,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"] |