Skip to content

Commit

Permalink
One dockerfile to rule them all
Browse files Browse the repository at this point in the history
  • Loading branch information
tylermenezes committed Dec 18, 2019
1 parent 449b4b6 commit e3070e9
Show file tree
Hide file tree
Showing 44 changed files with 54 additions and 41 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ jobs:
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: srnd/posters/posters-api
name: srnd/posters/posters
registry: docker.pkg.github.com
tag_names: true
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
context: ./API
9 changes: 0 additions & 9 deletions API/Dockerfile

This file was deleted.

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-buster

# Install fonts
ADD https://f1.srnd.org/fonts/posters-1.zip /fonts.zip
RUN apt-get install -y unzip \
&& unzip /fonts.zip -d /usr/share/fonts \
&& fc-cache -f

# Install Inkscape
RUN apt-get update \
&& apt-get -y install inkscape

# Install Node
RUN mkdir /node
WORKDIR /node
ENV NODE_VERSION 8.17.0
RUN ARCH= && dpkgArch="$(dpkg --print-architecture)" \
&& case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
ppc64el) ARCH='ppc64le';; \
s390x) ARCH='s390x';; \
arm64) ARCH='arm64';; \
armhf) ARCH='armv7l';; \
i386) ARCH='x86';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac \
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.xz" \
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH.tar.xz" -C /usr/local --strip-components=1 --no-same-owner

# Copy the app files
COPY ./api /app
COPY ./frontend /frontend

# Build and install the frontend
WORKDIR /frontend
RUN npm install \
&& npm run build \
&& cp -rf /frontend/build /app

# Install the python app
WORKDIR /app
RUN pip install -r requirements.txt

# Cleanup
RUN rm -rf /usr/local/bin/node \
&& rm -rf /usr/local/bin/npm \
&& rm -rf /node \
&& rm -rf /frontend

WORKDIR /app
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
29 changes: 0 additions & 29 deletions Makefile

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion API/generator.py → api/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ def make_posters(self,templates=env.list_templates()):
# subprocess.check_call(['inkscape {} --export-pdf={}'.format(input, output)], stdout=devnull, stderr=subprocess.STDOUT)
# else:
# print('Input file does not exist')
# return
# return
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.

0 comments on commit e3070e9

Please sign in to comment.